Struct strict_encoding::FieldName
source · pub struct FieldName(/* private fields */);
Implementations§
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 AsciiChar
s.
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 AsciiStr
s.
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 FieldName
impl AsRef<RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>> for FieldName
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 Borrow<RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>> for FieldName
impl Borrow<RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>> for FieldName
source§fn borrow(&self) -> &RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
fn borrow(&self) -> &RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
source§impl Deref for FieldName
impl Deref for FieldName
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 FieldName
impl<'de> Deserialize<'de> for FieldName
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 From<FieldName> for RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
impl From<FieldName> for RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>
source§impl From<RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>> for FieldName
impl From<RString<AlphaSmallLodash, AlphaNumLodash, 1, IDENT_MAX_LEN>> for FieldName
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 Ord for FieldName
impl Ord for FieldName
source§impl PartialOrd for FieldName
impl PartialOrd for FieldName
source§impl StrictDecode for FieldName
impl StrictDecode for FieldName
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
source§impl StrictDumb for FieldName
impl StrictDumb for FieldName
fn strict_dumb() -> Self
source§impl StrictEncode for FieldName
impl StrictEncode for FieldName
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, writer: impl WriteRaw) -> Result<()>
source§impl StrictTuple for FieldName
impl StrictTuple for FieldName
const FIELD_COUNT: u8 = 1u8
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
source§impl StrictType for FieldName
impl StrictType for FieldName
const STRICT_LIB_NAME: &'static str = STRICT_TYPES_LIB
fn strict_name() -> Option<TypeName>
source§impl Wrapper for FieldName
impl Wrapper for FieldName
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 FieldName
impl StrictProduct for FieldName
impl StructuralPartialEq for FieldName
Auto Trait Implementations§
impl Freeze for FieldName
impl RefUnwindSafe for FieldName
impl Send for FieldName
impl Sync for FieldName
impl Unpin for FieldName
impl UnwindSafe for FieldName
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
)