pub trait ElementConverter: Sized {
// Required methods
fn from_element(
element: Element,
document: &Document,
) -> Result<Self, XMLEditorError>;
fn into_children(
self,
document: &mut Document,
) -> Result<Vec<Element>, XMLEditorError>;
// Provided method
fn into_element(
self,
document: &mut Document,
) -> Result<Element, XMLEditorError>
where Self: HasElementName { ... }
}
Expand description
Converting an [Element] back and forth to a specific type.
Required Methods§
Sourcefn from_element(
element: Element,
document: &Document,
) -> Result<Self, XMLEditorError>
fn from_element( element: Element, document: &Document, ) -> Result<Self, XMLEditorError>
Converts an [Element] to the specific type.
Sourcefn into_children(
self,
document: &mut Document,
) -> Result<Vec<Element>, XMLEditorError>
fn into_children( self, document: &mut Document, ) -> Result<Vec<Element>, XMLEditorError>
Creates all children of the current type.
Provided Methods§
Sourcefn into_element(
self,
document: &mut Document,
) -> Result<Element, XMLEditorError>where
Self: HasElementName,
fn into_element(
self,
document: &mut Document,
) -> Result<Element, XMLEditorError>where
Self: HasElementName,
Creates an [Element] from the current type.
Default implementation creates an element with the from HasElementName::element_name of the type and adds all children returned by ElementConverter::into_children.
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.