DcCharExt

Trait DcCharExt 

Source
pub trait DcCharExt {
    // Required methods
    fn is_type_token(self) -> bool;
    fn fills_role(self, role: DcRole) -> bool;
    fn fills_role_with(
        self,
        role: DcRole,
        resolver: &dyn SyntaxRuleResolver,
    ) -> bool;
    fn to_short_vec(self) -> Vec<u32>;
    fn len_dctf(self) -> usize;
    fn len_utf_8e_128(self) -> usize;
    fn encode_buf(self, buf: &mut [u8]) -> usize;
    fn encode(self) -> Vec<u8> ⓘ;
}
Expand description

Extension methods for DcChar specific to document formats and serialization.

Required Methods§

Source

fn is_type_token(self) -> bool

Returns whether this character represents a type token.

Source

fn fills_role(self, role: DcRole) -> bool

Returns whether this character fills the specified syntactic or semantic role using the default compiled syntax resolver.

Source

fn fills_role_with( self, role: DcRole, resolver: &dyn SyntaxRuleResolver, ) -> bool

Returns whether this character fills the specified syntactic or semantic role according to the provided resolver.

Source

fn to_short_vec(self) -> Vec<u32>

Converts this character into a sequence of short Document Character IDs.

Source

fn len_dctf(self) -> usize

Returns the number of bytes required to encode this DcChar in DcTF (.dctf, f641) format (1..=23 bytes).

Source

fn len_utf_8e_128(self) -> usize

Returns the number of bytes required to encode this DcChar in legacy UTF-8e-128 (DcUtf, f89) format (1..=24 bytes).

Source

fn encode_buf(self, buf: &mut [u8]) -> usize

Encodes this DcChar in DcTF into the provided byte buffer (must be at least 23 bytes) and returns the number of bytes written.

Source

fn encode(self) -> Vec<u8> ⓘ

Encodes this DcChar in DcTF into a newly allocated Vec<u8>.

Implementors§