Struct ascii::Ascii [] [src]

pub struct Ascii {
    // some fields omitted
}

Datatype to hold one ascii character. It wraps a u8, with the highest bit always zero.

Methods

impl Ascii
[src]

fn from(ch: char) -> Result<Ascii()>

Constructs an Ascii character from a char.

Failure

Returns Err(()) if the character can't be ascii encoded.

Example

let a = Ascii::from('g').unwrap();
assert_eq!(a.as_char(), 'g');

fn as_byte(&self) -> u8

Converts an ascii character into a u8.

fn as_char(&self) -> char

Converts an ascii character into a char.

fn is_alphabetic(&self) -> bool

Check if the character is a letter (a-z, A-Z)

fn is_digit(&self) -> bool

Check if the character is a number (0-9)

fn is_alphanumeric(&self) -> bool

Check if the character is a letter or number

fn is_blank(&self) -> bool

Check if the character is a space or horizontal tab

fn is_control(&self) -> bool

Check if the character is a control character

fn is_graph(&self) -> bool

Checks if the character is printable (except space)

fn is_print(&self) -> bool

Checks if the character is printable (including space)

fn is_lowercase(&self) -> bool

Checks if the character is alphabetic and lowercase

fn is_uppercase(&self) -> bool

Checks if the character is alphabetic and uppercase

fn is_punctuation(&self) -> bool

Checks if the character is punctuation

fn is_hex(&self) -> bool

Checks if the character is a valid hex digit

Trait Implementations

impl Copy for Ascii
[src]

impl Hash for Ascii
[src]

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

Feeds this value into the state given, updating the hasher as necessary.

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0

Feeds a slice of this type into the state provided.

impl Eq for Ascii
[src]

impl Ord for Ascii
[src]

fn cmp(&self, __arg_0: &Ascii) -> Ordering

This method returns an Ordering between self and other. Read more

impl PartialOrd for Ascii
[src]

fn partial_cmp(&self, __arg_0: &Ascii) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more

fn lt(&self, __arg_0: &Ascii) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more

fn le(&self, __arg_0: &Ascii) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

fn gt(&self, __arg_0: &Ascii) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more

fn ge(&self, __arg_0: &Ascii) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialEq for Ascii
[src]

fn eq(&self, __arg_0: &Ascii) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Ascii) -> bool

This method tests for !=.

impl Clone for Ascii
[src]

fn clone(&self) -> Ascii

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Display for Ascii
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Debug for Ascii
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.