Struct strict_encoding::VariantName
source · pub struct VariantName(/* private fields */);Implementations§
source§impl VariantName
impl VariantName
Methods from Deref<Target = AsciiString>§
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of bytes that this ASCII string buffer can hold without reallocating.
§Examples
let s = String::with_capacity(10);
assert!(s.capacity() >= 10);Methods from Deref<Target = AsciiStr>§
sourcepub fn as_mut_slice(&mut self) -> &mut [AsciiChar]
pub fn as_mut_slice(&mut self) -> &mut [AsciiChar]
Returns the entire string as mutable slice of AsciiChars.
sourcepub fn as_ptr(&self) -> *const AsciiChar
pub fn as_ptr(&self) -> *const AsciiChar
Returns a raw pointer to the AsciiStr’s buffer.
The caller must ensure that the slice outlives the pointer this function returns, or else it
will end up pointing to garbage. Modifying the AsciiStr may cause it’s buffer to be
reallocated, which would also make any pointers to it invalid.
sourcepub fn as_mut_ptr(&mut self) -> *mut AsciiChar
pub fn as_mut_ptr(&mut self) -> *mut AsciiChar
Returns an unsafe mutable pointer to the AsciiStr’s buffer.
The caller must ensure that the slice outlives the pointer this function returns, or else it
will end up pointing to garbage. Modifying the AsciiStr may cause it’s buffer to be
reallocated, which would also make any pointers to it invalid.
sourcepub fn to_ascii_string(&self) -> AsciiString
Available on crate feature alloc only.
pub fn to_ascii_string(&self) -> AsciiString
alloc only.Copies the content of this AsciiStr into an owned AsciiString.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of characters / bytes in this ASCII sequence.
§Examples
let s = AsciiStr::from_ascii("foo").unwrap();
assert_eq!(s.len(), 3);sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the ASCII slice contains zero bytes.
§Examples
let mut empty = AsciiStr::from_ascii("").unwrap();
let mut full = AsciiStr::from_ascii("foo").unwrap();
assert!(empty.is_empty());
assert!(!full.is_empty());sourcepub fn chars_mut(&mut self) -> CharsMut<'_>
pub fn chars_mut(&mut self) -> CharsMut<'_>
Returns an iterator over the characters of the AsciiStr which allows you to modify the
value of each AsciiChar.
sourcepub fn split(&self, on: AsciiChar) -> impl DoubleEndedIterator
pub fn split(&self, on: AsciiChar) -> impl DoubleEndedIterator
Returns an iterator over parts of the AsciiStr separated by a character.
§Examples
let words = AsciiStr::from_ascii("apple banana lemon").unwrap()
.split(AsciiChar::Space)
.map(|a| a.as_str())
.collect::<Vec<_>>();
assert_eq!(words, ["apple", "banana", "lemon"]);sourcepub fn lines(&self) -> impl DoubleEndedIterator
pub fn lines(&self) -> impl DoubleEndedIterator
Returns an iterator over the lines of the AsciiStr, which are themselves AsciiStrs.
Lines are ended with either LineFeed (\n), or CarriageReturn then LineFeed (\r\n).
The final line ending is optional.
sourcepub fn trim(&self) -> &AsciiStr
pub fn trim(&self) -> &AsciiStr
Returns an ASCII string slice with leading and trailing whitespace removed.
§Examples
let example = AsciiStr::from_ascii(" \twhite \tspace \t").unwrap();
assert_eq!("white \tspace", example.trim());sourcepub fn trim_start(&self) -> &AsciiStr
pub fn trim_start(&self) -> &AsciiStr
Returns an ASCII string slice with leading whitespace removed.
§Examples
let example = AsciiStr::from_ascii(" \twhite \tspace \t").unwrap();
assert_eq!("white \tspace \t", example.trim_start());sourcepub fn trim_end(&self) -> &AsciiStr
pub fn trim_end(&self) -> &AsciiStr
Returns an ASCII string slice with trailing whitespace removed.
§Examples
let example = AsciiStr::from_ascii(" \twhite \tspace \t").unwrap();
assert_eq!(" \twhite \tspace", example.trim_end());sourcepub fn eq_ignore_ascii_case(&self, other: &AsciiStr) -> bool
pub fn eq_ignore_ascii_case(&self, other: &AsciiStr) -> bool
Compares two strings case-insensitively.
sourcepub fn make_ascii_uppercase(&mut self)
pub fn make_ascii_uppercase(&mut self)
Replaces lowercase letters with their uppercase equivalent.
sourcepub fn make_ascii_lowercase(&mut self)
pub fn make_ascii_lowercase(&mut self)
Replaces uppercase letters with their lowercase equivalent.
sourcepub fn to_ascii_uppercase(&self) -> AsciiString
Available on crate feature alloc only.
pub fn to_ascii_uppercase(&self) -> AsciiString
alloc only.Returns a copy of this string where letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’.
sourcepub fn to_ascii_lowercase(&self) -> AsciiString
Available on crate feature alloc only.
pub fn to_ascii_lowercase(&self) -> AsciiString
alloc only.Returns a copy of this string where letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’.
Trait Implementations§
source§impl AsRef<RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>> for VariantName
impl AsRef<RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>> for VariantName
source§fn as_ref(&self) -> &RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
fn as_ref(&self) -> &RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
source§impl AsRef<str> for VariantName
impl AsRef<str> for VariantName
source§impl Borrow<RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>> for VariantName
impl Borrow<RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>> for VariantName
source§fn borrow(&self) -> &RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
fn borrow(&self) -> &RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
source§impl Borrow<str> for VariantName
impl Borrow<str> for VariantName
source§impl Clone for VariantName
impl Clone for VariantName
source§fn clone(&self) -> VariantName
fn clone(&self) -> VariantName
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for VariantName
impl Debug for VariantName
source§impl Deref for VariantName
impl Deref for VariantName
source§type Target = RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
type Target = RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
source§impl<'de> Deserialize<'de> for VariantName
impl<'de> Deserialize<'de> for VariantName
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Display for VariantName
impl Display for VariantName
source§impl From<&'static str> for VariantName
impl From<&'static str> for VariantName
source§impl From<RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>> for VariantName
impl From<RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>> for VariantName
source§fn from(v: RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>) -> Self
fn from(v: RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>) -> Self
source§impl From<VariantName> for Ident
impl From<VariantName> for Ident
source§fn from(name: VariantName) -> Self
fn from(name: VariantName) -> Self
source§impl From<VariantName> for RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
impl From<VariantName> for RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
source§fn from(wrapped: VariantName) -> Self
fn from(wrapped: VariantName) -> Self
source§impl From<VariantName> for String
impl From<VariantName> for String
source§fn from(ident: VariantName) -> String
fn from(ident: VariantName) -> String
source§impl FromStr for VariantName
impl FromStr for VariantName
source§impl Hash for VariantName
impl Hash for VariantName
source§impl Ord for VariantName
impl Ord for VariantName
source§fn cmp(&self, other: &VariantName) -> Ordering
fn cmp(&self, other: &VariantName) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for VariantName
impl PartialEq for VariantName
source§impl PartialOrd for VariantName
impl PartialOrd for VariantName
source§impl Serialize for VariantName
impl Serialize for VariantName
source§impl StrictDecode for VariantName
impl StrictDecode for VariantName
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
source§impl StrictDumb for VariantName
impl StrictDumb for VariantName
fn strict_dumb() -> Self
source§impl StrictEncode for VariantName
impl StrictEncode for VariantName
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, writer: impl WriteRaw) -> Result<()>
source§impl StrictTuple for VariantName
impl StrictTuple for VariantName
const FIELD_COUNT: u8 = 1u8
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
source§impl StrictType for VariantName
impl StrictType for VariantName
const STRICT_LIB_NAME: &'static str = STRICT_TYPES_LIB
fn strict_name() -> Option<TypeName>
source§impl TryFrom<String> for VariantName
impl TryFrom<String> for VariantName
source§impl Wrapper for VariantName
impl Wrapper for VariantName
source§type Inner = RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
type Inner = RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
source§fn from_inner(inner: Self::Inner) -> Self
fn from_inner(inner: Self::Inner) -> Self
source§fn as_inner(&self) -> &Self::Inner
fn as_inner(&self) -> &Self::Inner
source§fn into_inner(self) -> Self::Inner
fn into_inner(self) -> Self::Inner
impl Eq for VariantName
impl StrictProduct for VariantName
impl StructuralPartialEq for VariantName
Auto Trait Implementations§
impl Freeze for VariantName
impl RefUnwindSafe for VariantName
impl Send for VariantName
impl Sync for VariantName
impl Unpin for VariantName
impl UnwindSafe for VariantName
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)