fn decode_string<TermBuilderT: ITermBuilder>(
  r: &mut BinaryReader, tb: &mut TermBuilderT)
  -> Hopefully<TermBuilderT::TermT>
{
  let n_elem = r.read_u16be();
  if n_elem == 0 {
    return Ok(tb.create_nil());
  }

  // Using mutability build list forward creating many cells and linking them
  let mut list_builder = tb.create_list_builder();
  let n_elem_minus_one = n_elem - 1;

  for i in 0..n_elem {
    let elem = r.read_u8();
    unsafe {
      let another = tb.create_small_s(elem as SWord);
      list_builder.set(another)
    }

    // Keep building forward
    if i < n_elem_minus_one {
      unsafe { list_builder.next() }
    }
  }

  unsafe { list_builder.end(tb.create_nil()) }
  Ok(list_builder.make_term())
}
/// A string of bytes encoded as tag 107 (String) with 16-bit length.
A string of bytes encoded as tag 107 (String) with 16-bit length.
A string of bytes encoded as tag 107 ( String ) with 16 - bit length .
fn decode_string<TermBuilderT: ITermBuilder>(
  r: &mut BinaryReader, tb: &mut TermBuilderT)
  -> Hopefully<TermBuilderT::TermT>
{
  let n_elem = r.read_u16be();
  if n_elem == 0 {
    return Ok(tb.create_nil());
  }
  // Using mutability build list forward creating many cells and linking them
  let mut list_builder = tb.create_list_builder();
  let n_elem_minus_one = n_elem - 1;
  for i in 0..n_elem {
    let elem = r.read_u8();
    unsafe {
      let another = tb.create_small_s(elem as SWord);
      list_builder.set(another)
    }
    // Keep building forward
    if i < n_elem_minus_one {
      unsafe { list_builder.next() }
    }
  }
  unsafe { list_builder.end(tb.create_nil()) }
  Ok(list_builder.make_term())
}
fn decode_string < TermBuilderT : ITermBuilder > ( r : & mut BinaryReader , tb : & mut TermBuilderT ) -> Hopefully < TermBuilderT :: TermT > { let n_elem = r . read_u16be ( ) ; if n_elem == 0 { return Ok ( tb . create_nil ( ) ) ; } // Using mutability build list forward creating many cells and linking them let mut list_builder = tb . create_list_builder ( ) ; let n_elem_minus_one = n_elem - 1 ; for i in 0 .. n_elem { let elem = r . read_u8 ( ) ; unsafe { let another = tb . create_small_s ( elem as SWord ) ; list_builder . set ( another ) } // Keep building forward if i < n_elem_minus_one { unsafe { list_builder . next ( ) } } } unsafe { list_builder . end ( tb . create_nil ( ) ) } Ok ( list_builder . make_term ( ) ) }
A string of bytes encoded as tag 107 (String) with 16-bit length.
A string of bytes encoded as tag 107 ( String ) with 16 - bit length .
r
&mut BinaryReader
tb
&mut TermBuilderT