pub fn try_from_slice(slice: &[u8]) -> Result<Self, ot::WrongSize> {
        use std::mem::transmute;

        let len = slice.len();
        if len > OT_NETWORK_NAME_MAX_SIZE as usize {
            return Err(ot::WrongSize);
        }

        sa::assert_eq_size!(u8, ::std::os::raw::c_char);

        // SAFETY: Casting signed bytes to unsigned bytes is defined behavior.
        let slice = unsafe { transmute::<&[u8], &[::std::os::raw::c_char]>(slice) };

        let mut ret = NetworkName::default();
        ret.0.m8[0..len].clone_from_slice(slice);

        Ok(ret)
    }
/// Tries to create a network name instance from the given byte slice.
Tries to create a network name instance from the given byte slice.
Tries to create a network name instance from the given byte slice .
pub fn try_from_slice(slice: &[u8]) -> Result<Self, ot::WrongSize> {
        use std::mem::transmute;
        let len = slice.len();
        if len > OT_NETWORK_NAME_MAX_SIZE as usize {
            return Err(ot::WrongSize);
        }
        sa::assert_eq_size!(u8, ::std::os::raw::c_char);
        // SAFETY: Casting signed bytes to unsigned bytes is defined behavior.
        let slice = unsafe { transmute::<&[u8], &[::std::os::raw::c_char]>(slice) };
        let mut ret = NetworkName::default();
        ret.0.m8[0..len].clone_from_slice(slice);
        Ok(ret)
    }
pub fn try_from_slice ( slice : & [ u8 ] ) -> Result < Self , ot :: WrongSize > { use std :: mem :: transmute ; let len = slice . len ( ) ; if len > OT_NETWORK_NAME_MAX_SIZE as usize { return Err ( ot :: WrongSize ) ; } sa :: assert_eq_size ! ( u8 std os raw c_char ) ; // SAFETY: Casting signed bytes to unsigned bytes is defined behavior. let slice = unsafe { transmute :: < & [ u8 ] , & [ :: std :: os :: raw :: c_char ] > ( slice ) } ; let mut ret = NetworkName :: default ( ) ; ret . 0 . m8 [ 0 .. len ] . clone_from_slice ( slice ) ; Ok ( ret ) }
Tries to create a network name instance from the given byte slice.
Tries to create a network name instance from the given byte slice .
slice
&[u8]
slice
&[u8]