pub trait IntoDocument {
// Required method
fn write_to(self, c: &mut DocumentConstructor) -> Result<(), WriteError>;
}Expand description
Trait for writing Rust types to Eure documents.
Types implementing this trait can be serialized into EureDocument
via DocumentConstructor.
§Examples
ⓘ
impl IntoDocument for User {
fn write_to(self, c: &mut DocumentConstructor) -> Result<(), WriteError> {
c.record(|rec| {
rec.field("name", self.name)?;
rec.field_optional("age", self.age)?;
Ok(())
})
}
}Required Methods§
Sourcefn write_to(self, c: &mut DocumentConstructor) -> Result<(), WriteError>
fn write_to(self, c: &mut DocumentConstructor) -> Result<(), WriteError>
Write this value to the current node in the document constructor.