pub trait ParseDocument<'doc>: Sized {
// Required method
fn parse(
doc: &'doc EureDocument,
node_id: NodeId,
) -> Result<Self, ParseError>;
}Expand description
Trait for parsing Rust types from Eure documents.
Types implementing this trait can be constructed from EureDocument.
Used for type-safe extraction of structures from documents during conversion.
§Lifetime Parameter
The 'doc lifetime ties the parsed output to the document’s lifetime,
allowing zero-copy parsing for reference types like &'doc str.
§Examples
ⓘ
// Reference type - borrows from document
impl<'doc> ParseDocument<'doc> for &'doc str { ... }
// Owned type - no lifetime dependency
impl ParseDocument<'_> for String { ... }Required Methods§
Sourcefn parse(doc: &'doc EureDocument, node_id: NodeId) -> Result<Self, ParseError>
fn parse(doc: &'doc EureDocument, node_id: NodeId) -> Result<Self, ParseError>
Parse a value of this type from an Eure document at the given node.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.