pub struct Article(/* 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 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
pub fn to_ascii_string(&self) -> AsciiString
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
pub fn to_ascii_uppercase(&self) -> AsciiString
Returns a copy of this string where letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’.
Sourcepub fn to_ascii_lowercase(&self) -> AsciiString
pub fn to_ascii_lowercase(&self) -> AsciiString
Returns a copy of this string where letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Article
impl<'de> Deserialize<'de> for Article
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Article, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Article, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Ord for Article
impl Ord for Article
Source§impl PartialOrd for Article
impl PartialOrd for Article
Source§impl Serialize for Article
impl Serialize for Article
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl StrictDecode for Article
impl StrictDecode for Article
fn strict_decode(reader: &mut impl TypedRead) -> Result<Article, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictDumb for Article
impl StrictDumb for Article
fn strict_dumb() -> Article
Source§impl StrictEncode for Article
impl StrictEncode for Article
fn strict_encode<W>(&self, writer: W) -> Result<W, Error>where
W: TypedWrite,
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictTuple for Article
impl StrictTuple for Article
const FIELD_COUNT: u8 = 1u8
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for Article
impl StrictType for Article
const STRICT_LIB_NAME: &'static str = LIB_NAME_RGB_CONTRACT
fn strict_name() -> Option<TypeName>
Source§impl Wrapper for Article
impl Wrapper for Article
Source§fn from_inner(inner: <Article as Wrapper>::Inner) -> Article
fn from_inner(inner: <Article as Wrapper>::Inner) -> Article
Source§fn as_inner(&self) -> &<Article as Wrapper>::Inner
fn as_inner(&self) -> &<Article as Wrapper>::Inner
Source§fn into_inner(self) -> <Article as Wrapper>::Inner
fn into_inner(self) -> <Article as Wrapper>::Inner
impl Eq for Article
impl StrictProduct for Article
impl StructuralPartialEq for Article
Auto Trait Implementations§
impl Freeze for Article
impl RefUnwindSafe for Article
impl Send for Article
impl Sync for Article
impl Unpin for Article
impl UnwindSafe for Article
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§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.