pub fn from_cell(cell: &CellRef) -> Option<BitCodeMonad> {
        match &**cell {
            SafasCell::Any(any_val)             => any_val.downcast_ref::<BitCodeMonad>().cloned(),
            SafasCell::Monad(cell, monad_type)  => {
                if let Some(result) = BitCodeMonad::from_cell(cell) { 
                    // Already a bitcode monad
                    Some(result) 
                } else {
                    // Call the map_fn to create a bitcode monad with the wrapped value
                    let create_monad    = FnMonad::from(|args: FlatMapArgs| CellRef::new(SafasCell::Any(Box::new(BitCodeMonad::with_value(args.monad_value)))));
                    let create_monad    = SafasCell::FrameMonad(Box::new(create_monad));
                    let (_frame, monad) = monad_type.flat_map(cell.clone(), create_monad.into(), Frame::new(1, None));

                    monad.ok()
                        .as_ref()
                        .and_then(|monad| Self::from_cell_no_flat_map(monad))
                }
            }
            _                                   => None
        }
    }
///
/// Attempts to retrieve a bitcode monad from a cell that contains either a monad or a 'raw' bitcode monad item.
/// 
/// For a monad cell, this will attempt to call flat_map to convert the monad into a bitcode monad (so this works with
/// standard wrapped values)
///
Attempts to retrieve a bitcode monad from a cell that contains either a monad or a 'raw' bitcode monad item.
For a monad cell, this will attempt to call flat_map to convert the monad into a bitcode monad (so this works with
standard wrapped values)
Attempts to retrieve a bitcode monad from a cell that contains either a monad or a ' raw ' bitcode monad item . For a monad cell this will attempt to call flat_map to convert the monad into a bitcode monad ( so this works with standard wrapped values )
pub fn from_cell(cell: &CellRef) -> Option<BitCodeMonad> {
        match &**cell {
            SafasCell::Any(any_val)             => any_val.downcast_ref::<BitCodeMonad>().cloned(),
            SafasCell::Monad(cell, monad_type)  => {
                if let Some(result) = BitCodeMonad::from_cell(cell) { 
                    // Already a bitcode monad
                    Some(result) 
                } else {
                    // Call the map_fn to create a bitcode monad with the wrapped value
                    let create_monad    = FnMonad::from(|args: FlatMapArgs| CellRef::new(SafasCell::Any(Box::new(BitCodeMonad::with_value(args.monad_value)))));
                    let create_monad    = SafasCell::FrameMonad(Box::new(create_monad));
                    let (_frame, monad) = monad_type.flat_map(cell.clone(), create_monad.into(), Frame::new(1, None));
                    monad.ok()
                        .as_ref()
                        .and_then(|monad| Self::from_cell_no_flat_map(monad))
                }
            }
            _                                   => None
        }
    }
pub fn from_cell ( cell : & CellRef ) -> Option < BitCodeMonad > { match & * * cell { SafasCell :: Any ( any_val ) => any_val . downcast_ref :: < BitCodeMonad > ( ) . cloned ( ) , SafasCell :: Monad ( cell , monad_type ) => { if let Some ( result ) = BitCodeMonad :: from_cell ( cell ) { // Already a bitcode monad Some ( result ) } else { // Call the map_fn to create a bitcode monad with the wrapped value let create_monad = FnMonad :: from ( | args : FlatMapArgs | CellRef :: new ( SafasCell :: Any ( Box :: new ( BitCodeMonad :: with_value ( args . monad_value ) ) ) ) ) ; let create_monad = SafasCell :: FrameMonad ( Box :: new ( create_monad ) ) ; let ( _frame , monad ) = monad_type . flat_map ( cell . clone ( ) , create_monad . into ( ) , Frame :: new ( 1 , None ) ) ; monad . ok ( ) . as_ref ( ) . and_then ( | monad | Self :: from_cell_no_flat_map ( monad ) ) } } _ => None } }
Attempts to retrieve a bitcode monad from a cell that contains either a monad or a 'raw' bitcode monad item.
Attempts to retrieve a bitcode monad from a cell that contains either a monad or a ' raw ' bitcode monad item .
cell
&CellRef
cell
&CellRef