pub fn new(s: &str) -> Atom {
    let b = s.as_bytes();
    let mut ord0 = 0u32;

    // This might be particularly ugly. Erlang/OTP does this by preallocating
    // a minimum of 4 bytes and taking from them unconditionally.
    if !b.is_empty() {
      ord0 = u32::from(b[0]) << 24;
      if b.len() > 1 {
        ord0 |= u32::from(b[1]) << 16;
        if b.len() > 2 {
          ord0 |= u32::from(b[2]) << 8;
          if b.len() > 3 {
            ord0 |= u32::from(b[3]);
          }
        }
      }
    }

    assert!(s.len() <= u16::MAX as usize);
    Atom {
      len: s.len() as u16,
      ord0,
      name: s.to_string(),
    }
  }
/// Create and fill atom description structure, it will exist forever on the
/// atom table in `AtomStorage`.
Create and fill atom description structure, it will exist forever on the
atom table in `AtomStorage`.
Create and fill atom description structure it will exist forever on the atom table in ` AtomStorage ` .
pub fn new(s: &str) -> Atom {
    let b = s.as_bytes();
    let mut ord0 = 0u32;
    // This might be particularly ugly. Erlang/OTP does this by preallocating
    // a minimum of 4 bytes and taking from them unconditionally.
    if !b.is_empty() {
      ord0 = u32::from(b[0]) << 24;
      if b.len() > 1 {
        ord0 |= u32::from(b[1]) << 16;
        if b.len() > 2 {
          ord0 |= u32::from(b[2]) << 8;
          if b.len() > 3 {
            ord0 |= u32::from(b[3]);
          }
        }
      }
    }
    assert!(s.len() <= u16::MAX as usize);
    Atom {
      len: s.len() as u16,
      ord0,
      name: s.to_string(),
    }
  }
pub fn new ( s : & str ) -> Atom { let b = s . as_bytes ( ) ; let mut ord0 = 0u32 ; // This might be particularly ugly. Erlang/OTP does this by preallocating // a minimum of 4 bytes and taking from them unconditionally. if ! b . is_empty ( ) { ord0 = u32 :: from ( b [ 0 ] ) << 24 ; if b . len ( ) > 1 { ord0 |= u32 :: from ( b [ 1 ] ) << 16 ; if b . len ( ) > 2 { ord0 |= u32 :: from ( b [ 2 ] ) << 8 ; if b . len ( ) > 3 { ord0 |= u32 :: from ( b [ 3 ] ) ; } } } } assert ! ( s len ( ) u16 MAX as usize ) ; Atom { len : s . len ( ) as u16 , ord0 , name : s . to_string ( ) , } }
Create and fill atom description structure, it will exist forever on the
atom table in `AtomStorage`.
Create and fill atom description structure it will exist forever on the atom table in ` AtomStorage ` .
s
&str