use std::ops::Deref;
use std::sync::{Arc, RwLock};
use crate::element::ElementProcessorSet;
use super::{
ElementDefinition, ElementDefinitionError, ElementDefinitionKind, ElementNameValue,
XMLElementName,
};
pub struct XMLElementDefinition {
element_definition: ElementDefinition,
}
impl XMLElementDefinition {
pub(crate) fn new(
name: Arc<XMLElementName>,
associated_processors: Arc<RwLock<ElementProcessorSet>>,
) -> Result<Self, ElementDefinitionError> {
Ok(Self {
element_definition: ElementDefinition::new(
ElementDefinitionKind::Xml,
Some(ElementNameValue::Xml(name)),
Some(associated_processors),
)?,
})
}
#[must_use]
pub const fn as_element_definition(&self) -> &ElementDefinition {
&self.element_definition
}
}
impl Deref for XMLElementDefinition {
type Target = ElementDefinition;
fn deref(&self) -> &Self::Target {
&self.element_definition
}
}