pub trait CesrCode:
Sealed
+ Copy
+ Eq
+ Debug {
// Required methods
fn to_matter_code(&self) -> MatterCode;
fn as_str(&self) -> &'static str;
// Provided methods
fn get_sizage(&self) -> Sizage { ... }
fn raw_size(&self) -> Result<usize, ValidationError> { ... }
fn placeholder(&self) -> Result<String, ValidationError> { ... }
}core only.Expand description
Sealed trait that all CESR typed codes must implement.
Provides the ability to convert to the untyped MatterCode, retrieve
the Base64 string representation, and look up the Sizage and raw byte size.
Required Methods§
Sourcefn to_matter_code(&self) -> MatterCode
fn to_matter_code(&self) -> MatterCode
Converts this typed code to the untyped MatterCode.
Provided Methods§
Sourcefn get_sizage(&self) -> Sizage
fn get_sizage(&self) -> Sizage
Returns the Sizage descriptor for this code.
Sourcefn raw_size(&self) -> Result<usize, ValidationError>
fn raw_size(&self) -> Result<usize, ValidationError>
Returns the expected raw byte size for this code.
§Errors
Returns a ValidationError for variable-size codes.
Sourcefn placeholder(&self) -> Result<String, ValidationError>
Available on crate feature alloc only.
fn placeholder(&self) -> Result<String, ValidationError>
alloc only.Returns a placeholder qb64 string of this code’s full character width,
filled with DUMMY_CHAR.
Reserves a self-addressing field’s exact byte span before its digest is
computed and back-patched over the placeholder. The width equals the
code’s fixed full size (fs).
§Errors
Returns ValidationError::InvalidSizingOperation for variable-size
codes, which have no fixed placeholder width.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".