[−][src]Struct fixed_len_str_example::fixed_str_nz12::FixedStrNZ12
A fixed length string with a length of 12.
Fields
array: [NonZeroU8; 12]
Methods
impl FixedStrNZ12
[src]
pub fn new(array: [NonZeroU8; 12]) -> Result<Self, Utf8Error>
[src]
Creates an FixedStrNZ12 from an array,returning an error at invalid utf8.
pub const unsafe fn new_unchecked(array: [NonZeroU8; 12]) -> Self
[src]
Creates an FixedStrNZ12 without checking if the bytes are valid utf8.
Safety
Ensure to only use this method with valid utf8.
pub fn as_bytes(&self) -> &[u8]
[src]
Borrow the internal array as an slice.
pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8]
[src]
Borrow the internal array as a mutable slice.
Safety
This is unsafe due to allow modifications that can produce invalid utf8.
pub fn into_vec(self) -> Vec<NonZeroU8>
[src]
Convert the FixedStrNZ12 into a vector of bytes.
pub fn into_string(self) -> String
[src]
Turn the FixedStrNZ12 into a string,moving the bytes.
pub fn from_vec(vec: Vec<NonZeroU8>) -> FixedStrNZ12
[src]
Construct a FixedStrNZ12 from a vector of bytes,truncating to adjust the size to 12.
Using this function with multi-byte characters can easely produce an unexpected value.
Panics
This function will panic if the length is less than 12.
pub fn from_string(string: String) -> FixedStrNZ12
[src]
Construct a FixedStrNZ12 from a String,truncating to adjust the size to 12.
Using this function with multi-byte characters can easely produce an unexpected value.
pub unsafe fn from_str_unchecked(s: &str) -> FixedStrNZ12
[src]
Construct a FixedStrNZ12 from a str,without checking if it has length 12.
Safety
This will trigger UB on str's with length different than 12.
Trait Implementations
impl AsMut<str> for FixedStrNZ12
[src]
impl AsRef<str> for FixedStrNZ12
[src]
impl Borrow<str> for FixedStrNZ12
[src]
impl BorrowMut<str> for FixedStrNZ12
[src]
fn borrow_mut(&mut self) -> &mut str
[src]
impl Clone for FixedStrNZ12
[src]
fn clone(&self) -> FixedStrNZ12
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for FixedStrNZ12
[src]
impl Deref for FixedStrNZ12
[src]
impl DerefMut for FixedStrNZ12
[src]
impl<'de> Deserialize<'de> for FixedStrNZ12
[src]
Only expanded in the original crate with the feature "serde_support" enabled.
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
[src]
impl Display for FixedStrNZ12
[src]
impl Eq for FixedStrNZ12
[src]
impl<'_> From<&'_ str> for FixedStrNZ12
[src]
fn from(s: &str) -> Self
[src]
Construct a FixedStrNZ12 from a string of length greater or equal to 12,if it is greater will take 12 bytes so be careful with no ascii letters.
Panics
This will panic if the length of s
is less than 12 and if it is greater on debug.
impl From<[NonZeroU8; 12]> for FixedStrNZ12
[src]
impl From<String> for FixedStrNZ12
[src]
impl From<Vec<NonZeroU8>> for FixedStrNZ12
[src]
impl Hash for FixedStrNZ12
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for FixedStrNZ12
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<'_> PartialEq<&'_ str> for FixedStrNZ12
[src]
impl PartialEq<FixedStrNZ12> for FixedStrNZ12
[src]
impl PartialEq<str> for FixedStrNZ12
[src]
impl PartialOrd<FixedStrNZ12> for FixedStrNZ12
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for FixedStrNZ12
[src]
Only expanded in the original crate with the feature "serde_support" enabled.
Auto Trait Implementations
impl RefUnwindSafe for FixedStrNZ12
impl Send for FixedStrNZ12
impl Sync for FixedStrNZ12
impl Unpin for FixedStrNZ12
impl UnwindSafe for FixedStrNZ12
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,