fn put_to_fork_with_mode<T: HashmapType + ?Sized>(
    slice: &mut SliceData, // TODO: BuilderData
    bit_len: usize,
    mut key: SliceData,
    leaf: &BuilderData,
    gas_consumer: &mut dyn GasConsumer,
    mode: u8
) -> Leaf {
    debug_assert!(slice.remaining_bits() == 0);
    let result;
    let next_index = key.get_next_bit_int()?;
    // hmn_fork#_ {n:#} {X:Type} left:^(Hashmap n X) right:^(Hashmap n X) = HashmapNode (n+1) X;
    let mut builder = BuilderData::new();
    if slice.remaining_references() != 2 {
        fail!(ExceptionCode::CellUnderflow)
    } else {
        if next_index == 1 {
            builder.checked_append_reference(slice.checked_drain_reference()?)?;
        }
        let mut cell = slice.checked_drain_reference()?;
        let bit_len = bit_len.checked_sub(1).ok_or(ExceptionCode::CellUnderflow)?;
        result = put_to_node_with_mode::<T>(&mut cell, bit_len, key, leaf, gas_consumer, mode);
        builder.checked_append_reference(cell)?;
        if next_index == 0 {
            builder.checked_append_reference(slice.checked_drain_reference()?)?;
        }
    }
    *slice = builder.into_cell()?.into();
    result
}
/// Puts element to required branch by first bit
Puts element to required branch by first bit
Puts element to required branch by first bit
fn put_to_fork_with_mode<T: HashmapType + ?Sized>(
    slice: &mut SliceData, // TODO: BuilderData
    bit_len: usize,
    mut key: SliceData,
    leaf: &BuilderData,
    gas_consumer: &mut dyn GasConsumer,
    mode: u8
) -> Leaf {
    debug_assert!(slice.remaining_bits() == 0);
    let result;
    let next_index = key.get_next_bit_int()?;
    // hmn_fork#_ {n:#} {X:Type} left:^(Hashmap n X) right:^(Hashmap n X) = HashmapNode (n+1) X;
    let mut builder = BuilderData::new();
    if slice.remaining_references() != 2 {
        fail!(ExceptionCode::CellUnderflow)
    } else {
        if next_index == 1 {
            builder.checked_append_reference(slice.checked_drain_reference()?)?;
        }
        let mut cell = slice.checked_drain_reference()?;
        let bit_len = bit_len.checked_sub(1).ok_or(ExceptionCode::CellUnderflow)?;
        result = put_to_node_with_mode::<T>(&mut cell, bit_len, key, leaf, gas_consumer, mode);
        builder.checked_append_reference(cell)?;
        if next_index == 0 {
            builder.checked_append_reference(slice.checked_drain_reference()?)?;
        }
    }
    *slice = builder.into_cell()?.into();
    result
}
fn put_to_fork_with_mode < T : HashmapType + ? Sized > ( slice : & mut SliceData , // TODO: BuilderData bit_len : usize , mut key : SliceData , leaf : & BuilderData , gas_consumer : & mut dyn GasConsumer , mode : u8 ) -> Leaf { debug_assert ! ( slice remaining_bits ( ) 0 ) ; let result ; let next_index = key . get_next_bit_int ( ) ? ; // hmn_fork#_ {n:#} {X:Type} left:^(Hashmap n X) right:^(Hashmap n X) = HashmapNode (n+1) X; let mut builder = BuilderData :: new ( ) ; if slice . remaining_references ( ) != 2 { fail ! ( ExceptionCode CellUnderflow ) } else { if next_index == 1 { builder . checked_append_reference ( slice . checked_drain_reference ( ) ? ) ? ; } let mut cell = slice . checked_drain_reference ( ) ? ; let bit_len = bit_len . checked_sub ( 1 ) . ok_or ( ExceptionCode :: CellUnderflow ) ? ; result = put_to_node_with_mode :: < T > ( & mut cell , bit_len , key , leaf , gas_consumer , mode ) ; builder . checked_append_reference ( cell ) ? ; if next_index == 0 { builder . checked_append_reference ( slice . checked_drain_reference ( ) ? ) ? ; } } * slice = builder . into_cell ( ) ? . into ( ) ; result }
Puts element to required branch by first bit
Puts element to required branch by first bit
slice
&mut SliceData
bit_len
usize
key
SliceData
leaf
&BuilderData
gas_consumer
&mut dyn GasConsumer
mode
u8
slice
&mut SliceData
bit_len
usize
key
SliceData
leaf
&BuilderData
gas_consumer
&mut dyn GasConsumer
mode
u8