pub struct SName(/* private fields */);Expand description
A null-terminated string that always maps to the 64 bytes assigned to it in Message.
You can get the string value back out with to_string():
let name: CString = sname.to_string();Implementations§
Source§impl SName
impl SName
Sourcepub const EMPTY: Self
pub const EMPTY: Self
A SName that contains all zero bytes.
This is more performant than SName::new(c"")
Sourcepub fn new(name: &CStr) -> Result<Self>
pub fn new(name: &CStr) -> Result<Self>
Construct a valid sname field.
name must not be more 64 bytes.
Sourcepub fn from_slice_unchecked(name: &[u8]) -> Self
pub fn from_slice_unchecked(name: &[u8]) -> Self
Converts an array slice of exactly 64 byte length into a SName without performing any checks (such as length or null-termination).
Panics if slice is not 64 bytes.
Useful if you are handling the return of parse_sname.
Trait Implementations§
impl StructuralPartialEq for SName
Auto Trait Implementations§
impl Freeze for SName
impl RefUnwindSafe for SName
impl Send for SName
impl Sync for SName
impl Unpin for SName
impl UnwindSafe for SName
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more