fn pack_str(s: &str) -> Result<u64> {
    if s.len() > 8 {
        return err!("cannot encode string {:?} (too long)", s);
    }
    if s.contains('\x00') {
        return err!("cannot encode string {:?} (contains NUL byte)", s);
    }
    let mut value = 0;
    for (i, &b) in s.as_bytes().iter().enumerate() {
        assert!(i <= 7);
        value |= (b as u64) << (8 * i as u64);
    }
    Ok(value)
}
/// Convert the given string into a u64, where the least significant byte of
/// the u64 is the first byte of the string.
///
/// If the string contains any `NUL` bytes or has more than 8 bytes, then an
/// error is returned.
Convert the given string into a u64, where the least significant byte of
the u64 is the first byte of the string.

If the string contains any `NUL` bytes or has more than 8 bytes, then an
error is returned.
Convert the given string into a u64 where the least significant byte of the u64 is the first byte of the string . If the string contains any ` NUL ` bytes or has more than 8 bytes then an error is returned .
fn pack_str(s: &str) -> Result<u64> {
    if s.len() > 8 {
        return err!("cannot encode string {:?} (too long)", s);
    }
    if s.contains('\x00') {
        return err!("cannot encode string {:?} (contains NUL byte)", s);
    }
    let mut value = 0;
    for (i, &b) in s.as_bytes().iter().enumerate() {
        assert!(i <= 7);
        value |= (b as u64) << (8 * i as u64);
    }
    Ok(value)
}
fn pack_str ( s : & str ) -> Result < u64 > { if s . len ( ) > 8 { return err ! ( " " s ) ; } if s . contains ( '\x00' ) { return err ! ( " " s ) ; } let mut value = 0 ; for ( i , & b ) in s . as_bytes ( ) . iter ( ) . enumerate ( ) { assert ! ( i 7 ) ; value |= ( b as u64 ) << ( 8 * i as u64 ) ; } Ok ( value ) }
Convert the given string into a u64, where the least significant byte of
the u64 is the first byte of the string.
Convert the given string into a u64 where the least significant byte of the u64 is the first byte of the string .
s
&str
s
&str