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§
Sourcefn is_type_token(self) -> bool
fn is_type_token(self) -> bool
Returns whether this character represents a type token.
Sourcefn fills_role(self, role: DcRole) -> bool
fn fills_role(self, role: DcRole) -> bool
Returns whether this character fills the specified syntactic or semantic role using the default compiled syntax resolver.
Sourcefn fills_role_with(
self,
role: DcRole,
resolver: &dyn SyntaxRuleResolver,
) -> bool
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.
Sourcefn to_short_vec(self) -> Vec<u32>
fn to_short_vec(self) -> Vec<u32>
Converts this character into a sequence of short Document Character IDs.
Sourcefn len_dctf(self) -> usize
fn len_dctf(self) -> usize
Returns the number of bytes required to encode this DcChar in
DcTF (.dctf, f641) format (1..=23 bytes).
Sourcefn len_utf_8e_128(self) -> usize
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).
Sourcefn encode_buf(self, buf: &mut [u8]) -> usize
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.