Struct strict_encoding::stl::AsciiSym
source · pub struct AsciiSym(/* private fields */);
Methods from Deref<Target = AsciiChar>§
pub fn is_ascii_alphabetic(&self) -> bool
pub fn is_ascii_alphabetic(&self) -> bool
Check if the character is a letter (a-z, A-Z).
This method is identical to is_alphabetic()
pub fn is_ascii_digit(&self) -> bool
pub fn is_ascii_digit(&self) -> bool
Check if the character is a number (0-9)
Examples
assert_eq!(AsciiChar::new('0').is_ascii_digit(), true);
assert_eq!(AsciiChar::new('9').is_ascii_digit(), true);
assert_eq!(AsciiChar::new('a').is_ascii_digit(), false);
assert_eq!(AsciiChar::new('A').is_ascii_digit(), false);
assert_eq!(AsciiChar::new('/').is_ascii_digit(), false);
pub fn is_ascii_alphanumeric(&self) -> bool
pub fn is_ascii_alphanumeric(&self) -> bool
Check if the character is a letter or number
This method is identical to is_alphanumeric()
pub fn is_ascii_blank(&self) -> bool
pub fn is_ascii_blank(&self) -> bool
Check if the character is a space or horizontal tab
Examples
assert!(AsciiChar::Space.is_ascii_blank());
assert!(AsciiChar::Tab.is_ascii_blank());
assert!(!AsciiChar::VT.is_ascii_blank());
assert!(!AsciiChar::LineFeed.is_ascii_blank());
assert!(!AsciiChar::CarriageReturn.is_ascii_blank());
assert!(!AsciiChar::FF.is_ascii_blank());
pub fn is_ascii_whitespace(&self) -> bool
pub fn is_ascii_whitespace(&self) -> bool
Check if the character is a ’ ’, ‘\t’, ‘\n’, ‘\r’ or ‘\0xc’ (form feed).
This method is NOT identical to is_whitespace()
.
pub fn is_ascii_control(&self) -> bool
pub fn is_ascii_control(&self) -> bool
Check if the character is a control character
Examples
assert_eq!(AsciiChar::new('\0').is_ascii_control(), true);
assert_eq!(AsciiChar::new('n').is_ascii_control(), false);
assert_eq!(AsciiChar::new(' ').is_ascii_control(), false);
assert_eq!(AsciiChar::new('\n').is_ascii_control(), true);
assert_eq!(AsciiChar::new('\t').is_ascii_control(), true);
assert_eq!(AsciiChar::EOT.is_ascii_control(), true);
pub fn is_ascii_graphic(&self) -> bool
pub fn is_ascii_graphic(&self) -> bool
Checks if the character is printable (except space)
Examples
assert_eq!(AsciiChar::new('n').is_ascii_graphic(), true);
assert_eq!(AsciiChar::new(' ').is_ascii_graphic(), false);
assert_eq!(AsciiChar::new('\n').is_ascii_graphic(), false);
pub fn is_ascii_printable(&self) -> bool
pub fn is_ascii_printable(&self) -> bool
Checks if the character is printable (including space)
Examples
assert_eq!(AsciiChar::new('n').is_ascii_printable(), true);
assert_eq!(AsciiChar::new(' ').is_ascii_printable(), true);
assert_eq!(AsciiChar::new('\n').is_ascii_printable(), false);
pub fn is_ascii_lowercase(&self) -> bool
pub fn is_ascii_lowercase(&self) -> bool
Checks if the character is alphabetic and lowercase (a-z).
This method is identical to is_lowercase()
pub fn is_ascii_uppercase(&self) -> bool
pub fn is_ascii_uppercase(&self) -> bool
Checks if the character is alphabetic and uppercase (A-Z).
This method is identical to is_uppercase()
pub fn is_ascii_punctuation(&self) -> bool
pub fn is_ascii_punctuation(&self) -> bool
Checks if the character is punctuation
Examples
assert_eq!(AsciiChar::new('n').is_ascii_punctuation(), false);
assert_eq!(AsciiChar::new(' ').is_ascii_punctuation(), false);
assert_eq!(AsciiChar::new('_').is_ascii_punctuation(), true);
assert_eq!(AsciiChar::new('~').is_ascii_punctuation(), true);
pub fn is_ascii_hexdigit(&self) -> bool
pub fn is_ascii_hexdigit(&self) -> bool
Checks if the character is a valid hex digit
Examples
assert_eq!(AsciiChar::new('5').is_ascii_hexdigit(), true);
assert_eq!(AsciiChar::new('a').is_ascii_hexdigit(), true);
assert_eq!(AsciiChar::new('F').is_ascii_hexdigit(), true);
assert_eq!(AsciiChar::new('G').is_ascii_hexdigit(), false);
assert_eq!(AsciiChar::new(' ').is_ascii_hexdigit(), false);
pub fn make_ascii_uppercase(&mut self)
pub fn make_ascii_uppercase(&mut self)
Replaces letters a
to z
with A
to Z
pub fn make_ascii_lowercase(&mut self)
pub fn make_ascii_lowercase(&mut self)
Replaces letters A
to Z
with a
to z
pub fn to_ascii_uppercase(&self) -> AsciiChar
pub fn to_ascii_uppercase(&self) -> AsciiChar
Maps letters a-z to A-Z and returns any other character unchanged.
Examples
assert_eq!(AsciiChar::new('u').to_ascii_uppercase().as_char(), 'U');
assert_eq!(AsciiChar::new('U').to_ascii_uppercase().as_char(), 'U');
assert_eq!(AsciiChar::new('2').to_ascii_uppercase().as_char(), '2');
assert_eq!(AsciiChar::new('=').to_ascii_uppercase().as_char(), '=');
assert_eq!(AsciiChar::new('[').to_ascii_uppercase().as_char(), '[');
pub fn to_ascii_lowercase(&self) -> AsciiChar
pub fn to_ascii_lowercase(&self) -> AsciiChar
Maps letters A-Z to a-z and returns any other character unchanged.
Examples
assert_eq!(AsciiChar::new('U').to_ascii_lowercase().as_char(), 'u');
assert_eq!(AsciiChar::new('u').to_ascii_lowercase().as_char(), 'u');
assert_eq!(AsciiChar::new('2').to_ascii_lowercase().as_char(), '2');
assert_eq!(AsciiChar::new('^').to_ascii_lowercase().as_char(), '^');
assert_eq!(AsciiChar::new('\x7f').to_ascii_lowercase().as_char(), '\x7f');
pub fn eq_ignore_ascii_case(&self, other: &AsciiChar) -> bool
pub fn eq_ignore_ascii_case(&self, other: &AsciiChar) -> bool
Compares two characters case-insensitively.
Trait Implementations§
source§impl Ord for AsciiSym
impl Ord for AsciiSym
source§impl PartialEq for AsciiSym
impl PartialEq for AsciiSym
source§impl PartialOrd for AsciiSym
impl PartialOrd for AsciiSym
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StrictDecode for AsciiSym
impl StrictDecode for AsciiSym
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(lim: usize, reader: impl Read) -> Result<Self, DecodeError>
source§impl StrictDumb for AsciiSym
impl StrictDumb for AsciiSym
fn strict_dumb() -> Self
source§impl StrictEncode for AsciiSym
impl StrictEncode for AsciiSym
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, lim: usize, writer: impl Write) -> Result<usize>
source§impl StrictEnum for AsciiSym
impl StrictEnum for AsciiSym
fn from_variant_name(name: &FieldName) -> Result<Self, VariantError<&FieldName>>
fn strict_type_info() -> TypeInfo<Self>
source§impl StrictSum for AsciiSym
impl StrictSum for AsciiSym
const ALL_VARIANTS: &'static [(u8, &'static str)] = _
fn variant_name(&self) -> &'static str
fn strict_check_variants()
fn variant_name_by_tag(tag: u8) -> Option<FieldName>
fn variant_ord(&self) -> u8
source§impl StrictType for AsciiSym
impl StrictType for AsciiSym
const STRICT_LIB_NAME: &'static str = LIB_NAME_STD
fn strict_name() -> Option<TypeName>
source§impl Wrapper for AsciiSym
impl Wrapper for AsciiSym
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
source§impl WrapperMut for AsciiSym
impl WrapperMut for AsciiSym
source§fn as_inner_mut(&mut self) -> &mut <Self as Wrapper>::Inner
fn as_inner_mut(&mut self) -> &mut <Self as Wrapper>::Inner
impl Copy for AsciiSym
impl Eq for AsciiSym
impl StructuralEq for AsciiSym
impl StructuralPartialEq for AsciiSym
Auto Trait Implementations§
impl RefUnwindSafe for AsciiSym
impl Send for AsciiSym
impl Sync for AsciiSym
impl Unpin for AsciiSym
impl UnwindSafe for AsciiSym
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.