pub struct Table { /* private fields */ }
Expand description
A table specifying the byte patterns allowed in a string.
Implementations§
Source§impl Table
impl Table
Sourcepub const fn new(bytes: &[u8]) -> Table
pub const fn new(bytes: &[u8]) -> Table
Creates a table that only allows the given unencoded bytes.
§Panics
Panics if any of the bytes is not ASCII or equals b'%'
.
Sourcepub const fn or(self, other: &Table) -> Table
pub const fn or(self, other: &Table) -> Table
Combines two tables into one.
Returns a new table that allows all the byte patterns allowed
by self
or by other
.
Sourcepub const fn or_pct_encoded(self) -> Table
pub const fn or_pct_encoded(self) -> Table
Marks this table as allowing percent-encoded octets.
Sourcepub const fn or_ucschar(self) -> Table
pub const fn or_ucschar(self) -> Table
Marks this table as allowing characters matching the ucschar
ABNF rule from RFC 3987.
Sourcepub const fn or_iprivate(self) -> Table
pub const fn or_iprivate(self) -> Table
Marks this table as allowing characters matching the iprivate
ABNF rule from RFC 3987.
Sourcepub const fn sub(self, other: &Table) -> Table
pub const fn sub(self, other: &Table) -> Table
Subtracts from this table.
Returns a new table that allows all the byte patterns allowed
by self
but not allowed by other
.
Sourcepub const fn is_subset(&self, other: &Table) -> bool
pub const fn is_subset(&self, other: &Table) -> bool
Checks whether the table is a subset of another, i.e., other
allows at least all the byte patterns allowed by self
.
Sourcepub const fn allows(&self, ch: char) -> bool
pub const fn allows(&self, ch: char) -> bool
Checks whether the given unencoded character is allowed by the table.
Sourcepub const fn allows_pct_encoded(&self) -> bool
pub const fn allows_pct_encoded(&self) -> bool
Checks whether percent-encoded octets are allowed by the table.