logos.lang.ascii

Module lang · package logos-lang

Types

structAsciiChar

struct AsciiChar

An ASCII character: a u8 guaranteed to be in 0..=127.

Newtype struct, not Rust’s 128-variant enum; constructors enforce the range invariant.

Fields

byte: u8

Methods

fn as_char(self: AsciiChar) -> char

Returns the character widened to char (same codepoint).

fn as_u8(self: AsciiChar) -> u8

Returns the underlying byte value.

fn from_u8(b: u8) -> Option

Creates an AsciiChar from a byte, returning None if b >= 128.

fn from_u8_unchecked(b: u8) -> AsciiChar

Creates an AsciiChar without range validation.

Caller must guarantee b < 128; a larger byte silently breaks the type invariant.

fn is_alphabetic(self: AsciiChar) -> bool

Returns true for ASCII letters 'A'..='Z' or 'a'..='z'.

fn is_alphanumeric(self: AsciiChar) -> bool

Returns true for ASCII letters or digits.

fn is_control(self: AsciiChar) -> bool

Returns true for ASCII control characters: 0..=31 or DEL (127).

fn is_digit(self: AsciiChar) -> bool

Returns true for ASCII digits '0'..='9'.

fn is_hexdigit(self: AsciiChar) -> bool

Returns true for ASCII hex digits: 0-9, A-F, or a-f.

fn is_lowercase(self: AsciiChar) -> bool

Returns true for ASCII lowercase letters 'a'..='z'.

fn is_uppercase(self: AsciiChar) -> bool

Returns true for ASCII uppercase letters 'A'..='Z'.

fn is_whitespace(self: AsciiChar) -> bool

Returns true for whitespace: space, tab, LF, VT, FF, or CR.

Includes VT (0x0B), unlike u8::is_ascii_whitespace.

fn to_ascii_lowercase(self: AsciiChar) -> AsciiChar

Returns the character lowercased if 'A'..='Z', unchanged otherwise.

fn to_ascii_uppercase(self: AsciiChar) -> AsciiChar

Returns the character uppercased if 'a'..='z', unchanged otherwise.

Functions

fnascii_backspace

fn ascii_backspace() -> AsciiChar

Returns the BS (backspace) character (0x08).

fnascii_bell

fn ascii_bell() -> AsciiChar

Returns the BEL (bell) character (0x07).

fnascii_carriage_ret

fn ascii_carriage_ret() -> AsciiChar

Returns the CR (carriage return) character (0x0D).

fnascii_delete

fn ascii_delete() -> AsciiChar

Returns the DEL character (0x7F).

fnascii_escape

fn ascii_escape() -> AsciiChar

Returns the ESC (escape) character (0x1B).

fnascii_form_feed

fn ascii_form_feed() -> AsciiChar

Returns the FF (form feed) character (0x0C).

fnascii_line_feed

fn ascii_line_feed() -> AsciiChar

Returns the LF (line feed) character (0x0A).

fnascii_null

fn ascii_null() -> AsciiChar

Returns the NUL character (0x00).

fnascii_space

fn ascii_space() -> AsciiChar

Returns the SPACE character (0x20).

fnascii_tab

fn ascii_tab() -> AsciiChar

Returns the TAB character (0x09).

fnascii_vert_tab

fn ascii_vert_tab() -> AsciiChar

Returns the VT (vertical tab) character (0x0B).