README

marianoguerra/uri/enc does not have a README file

#
Encoder

pub trait Encoder {
fn table() -> Table
}

Percent-encoders for URI/IRI components.

An encoder is a zero-sized marker type used as the type parameter of [EStr] and [EString]. It carries the [Table] that specifies which byte patterns the string may contain.

A sub-encoder Sub of E is an encoder whose table is a subset of E's.

#
PathEncoder

pub trait PathEncoder : Encoder {
}

An encoder for a path component, for which EStr has extension methods.

#
Data

pub enum Data {
}

An encoder for URI data which preserves only unreserved characters and encodes the others.

impl Encoder for Data

#
Fragment

pub enum Fragment {
}

An encoder for URI fragment.
impl Encoder for Fragment

#
IData

pub enum IData {
}

An encoder for IRI data which preserves only unreserved characters and encodes the others.

impl Encoder for IData

#
IFragment

pub enum IFragment {
}

An encoder for IRI fragment.

#
IPath

pub enum IPath {
}

An encoder for IRI path.
impl Encoder for IPath

#
IQuery

pub enum IQuery {
}

An encoder for IRI query.
impl Encoder for IQuery

#
IRegName

pub enum IRegName {
}

An encoder for IRI registered name.
impl Encoder for IRegName

#
IUserinfo

pub enum IUserinfo {
}

An encoder for IRI userinfo.

#
Path

pub enum Path {
}

An encoder for URI path.
impl Encoder for Path
impl PathEncoder for Path

#
Port

pub enum Port {
}

An encoder for URI/IRI port.
impl Encoder for Port

#
Query

pub enum Query {
}

An encoder for URI query.
impl Encoder for Query

#
RegName

pub enum RegName {
}

An encoder for URI registered name.
impl Encoder for RegName

#
Table

pub struct Table(UInt64, UInt64) derive(Eq)

Byte pattern tables from RFC 3986 and RFC 3987.

A Table specifies which unencoded characters, and whether percent-encoded octets, are allowed in a string. Tables are combined with [Table::or] and friends to describe the ABNF rules of URI/IRI components.

The predefined tables in this package are documented with the ABNF notation of RFC 5234.

#
Table::allows

fn Table::allows(self : Table, ch : Char) -> Bool

Checks whether the given unencoded character is allowed by the table.

#
Table::allows_ascii

fn Table::allows_ascii(self : Table, x : Int) -> Bool

Checks whether the given ASCII code is allowed unencoded by the table.

#
Table::allows_code_point

fn Table::allows_code_point(self : Table, x : Int) -> Bool

Checks whether the given code point is allowed unencoded by the table.

#
Table::allows_non_ascii

fn Table::allows_non_ascii(self : Table) -> Bool

Checks whether the table allows any non-ASCII character.

#
Table::allows_pct_encoded

fn Table::allows_pct_encoded(self : Table) -> Bool

Checks whether percent-encoded octets are allowed by the table.

#
Table::is_subset

fn Table::is_subset(self : Table, 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.

#
Table::new

fn Table::new(chars : String) -> Table

Creates a table that only allows the given unencoded characters.

Panics

Panics if any of the characters is not ASCII or equals '\u{0}', '\u{1}', or '%'.

test {
let t = @enc.Table::new("abc")
assert_true(t.allows('a'))
assert_false(t.allows('d'))
assert_false(t.allows_pct_encoded())
}

#
Table::or

fn Table::or(self : Table, other : Table) -> Table

Combines two tables into one.

Returns a new table that allows all the byte patterns allowed by self or by other.

#
Table::or_iprivate

fn Table::or_iprivate(self : Table) -> Table

Marks this table as allowing characters matching the iprivate ABNF rule from RFC 3987.

#
Table::or_pct_encoded

fn Table::or_pct_encoded(self : Table) -> Table

Marks this table as allowing percent-encoded octets.

#
Table::or_ucschar

fn Table::or_ucschar(self : Table) -> Table

Marks this table as allowing characters matching the ucschar ABNF rule from RFC 3987.

#
Table::sub

fn Table::sub(self : Table, 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.

#
Userinfo

pub enum Userinfo {
}

An encoder for URI userinfo.
impl Encoder for Userinfo

#
table_alpha

let table_alpha : Table

ALPHA = %x41-5A / %x61-7A

#
table_data

let table_data : Table

#
table_digit

let table_digit : Table

DIGIT = %x30-39

#
table_fragment

let table_fragment : Table

fragment = *( pchar / "/" / "?" )

#
table_gen_delims

let table_gen_delims : Table

gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"

#
table_hexdig

let table_hexdig : Table

HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"

#
table_idata

let table_idata : Table

#
table_ifragment

let table_ifragment : Table

ifragment = *( ipchar / "/" / "?" )

#
table_ipath

let table_ipath : Table

ipath = *( ipchar / "/" )

#
table_ipv_future

let table_ipv_future : Table

IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )

#
table_iquery

let table_iquery : Table

iquery = *( ipchar / iprivate / "/" / "?" )

#
table_ireg_name

let table_ireg_name : Table

ireg-name = *( iunreserved / pct-encoded / sub-delims )

#
table_isegment_nz_nc

let table_isegment_nz_nc : Table

isegment-nz-nc = 1*( iunreserved / pct-encoded / sub-delims / "@" )

#
table_iuserinfo

let table_iuserinfo : Table

iuserinfo = *( iunreserved / pct-encoded / sub-delims / ":" )

#
table_path

let table_path : Table

path = *( pchar / "/" )

#
table_pchar

let table_pchar : Table

pchar = unreserved / pct-encoded / sub-delims / ":" / "@"

#
table_query

let table_query : Table

query = *( pchar / "/" / "?" )

#
table_reg_name

let table_reg_name : Table

reg-name = *( unreserved / pct-encoded / sub-delims )

#
table_reserved

let table_reserved : Table

reserved = gen-delims / sub-delims

#
table_scheme

let table_scheme : Table

scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

#
table_segment_nz_nc

let table_segment_nz_nc : Table

segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )

#
table_sub_delims

let table_sub_delims : Table

sub-delims = "!" / "$" / "&" / "'" / "(" / ")"/ "*" / "+" / "," / ";" / "="

#
table_unreserved

let table_unreserved : Table

unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"

#
table_userinfo

let table_userinfo : Table

userinfo = *( unreserved / pct-encoded / sub-delims / ":" )

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io