Struct strict_encoding::stl::AsciiPrintable
source · pub struct AsciiPrintable(/* 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 AsMut<<AsciiPrintable as Wrapper>::Inner> for AsciiPrintable
impl AsMut<<AsciiPrintable as Wrapper>::Inner> for AsciiPrintable
source§impl AsRef<AsciiChar> for AsciiPrintable
impl AsRef<AsciiChar> for AsciiPrintable
source§impl Borrow<AsciiChar> for AsciiPrintable
impl Borrow<AsciiChar> for AsciiPrintable
source§impl BorrowMut<<AsciiPrintable as Wrapper>::Inner> for AsciiPrintable
impl BorrowMut<<AsciiPrintable as Wrapper>::Inner> for AsciiPrintable
source§impl Clone for AsciiPrintable
impl Clone for AsciiPrintable
source§fn clone(&self) -> AsciiPrintable
fn clone(&self) -> AsciiPrintable
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AsciiPrintable
impl Debug for AsciiPrintable
source§impl Deref for AsciiPrintable
impl Deref for AsciiPrintable
source§impl DerefMut for AsciiPrintable
impl DerefMut for AsciiPrintable
source§impl Display for AsciiPrintable
impl Display for AsciiPrintable
source§impl From<AsciiChar> for AsciiPrintable
impl From<AsciiChar> for AsciiPrintable
source§impl From<AsciiPrintable> for AsciiChar
impl From<AsciiPrintable> for AsciiChar
source§fn from(wrapped: AsciiPrintable) -> Self
fn from(wrapped: AsciiPrintable) -> Self
source§impl From<AsciiPrintable> for u8
impl From<AsciiPrintable> for u8
source§fn from(value: AsciiPrintable) -> Self
fn from(value: AsciiPrintable) -> Self
source§impl Hash for AsciiPrintable
impl Hash for AsciiPrintable
source§impl Ord for AsciiPrintable
impl Ord for AsciiPrintable
source§fn cmp(&self, other: &AsciiPrintable) -> Ordering
fn cmp(&self, other: &AsciiPrintable) -> 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 AsciiPrintable
impl PartialEq for AsciiPrintable
source§fn eq(&self, other: &AsciiPrintable) -> bool
fn eq(&self, other: &AsciiPrintable) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for AsciiPrintable
impl PartialOrd for AsciiPrintable
source§fn partial_cmp(&self, other: &AsciiPrintable) -> Option<Ordering>
fn partial_cmp(&self, other: &AsciiPrintable) -> Option<Ordering>
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 AsciiPrintable
impl StrictDecode for AsciiPrintable
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 AsciiPrintable
impl StrictDumb for AsciiPrintable
fn strict_dumb() -> Self
source§impl StrictEncode for AsciiPrintable
impl StrictEncode for AsciiPrintable
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 AsciiPrintable
impl StrictEnum for AsciiPrintable
fn from_variant_name(name: &FieldName) -> Result<Self, VariantError<&FieldName>>
fn strict_type_info() -> TypeInfo<Self>
source§impl StrictSum for AsciiPrintable
impl StrictSum for AsciiPrintable
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 AsciiPrintable
impl StrictType for AsciiPrintable
const STRICT_LIB_NAME: &'static str = LIB_NAME_STD
fn strict_name() -> Option<TypeName>
source§impl TryFrom<u8> for AsciiPrintable
impl TryFrom<u8> for AsciiPrintable
source§impl Wrapper for AsciiPrintable
impl Wrapper for AsciiPrintable
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 AsciiPrintable
impl WrapperMut for AsciiPrintable
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 AsciiPrintable
impl Eq for AsciiPrintable
impl StructuralEq for AsciiPrintable
impl StructuralPartialEq for AsciiPrintable
Auto Trait Implementations§
impl RefUnwindSafe for AsciiPrintable
impl Send for AsciiPrintable
impl Sync for AsciiPrintable
impl Unpin for AsciiPrintable
impl UnwindSafe for AsciiPrintable
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.