use std::ops::Deref;
use std::sync::{Arc, RwLock};
use crate::element::ElementProcessorSet;
use super::{
AttributeDefinition, AttributeDefinitionError, AttributeDefinitionKind, AttributeNameValue,
TextAttributeName,
};
pub struct TextAttributeDefinition {
attribute_definition: AttributeDefinition,
}
impl TextAttributeDefinition {
pub(crate) fn new(
name: Arc<TextAttributeName>,
associated_processors: Arc<RwLock<ElementProcessorSet>>,
) -> Result<Self, AttributeDefinitionError> {
Ok(Self {
attribute_definition: AttributeDefinition::new(
AttributeDefinitionKind::Text,
Some(AttributeNameValue::Text(name)),
Some(associated_processors),
)?,
})
}
#[must_use]
pub const fn as_attribute_definition(&self) -> &AttributeDefinition {
&self.attribute_definition
}
}
impl Deref for TextAttributeDefinition {
type Target = AttributeDefinition;
fn deref(&self) -> &Self::Target {
&self.attribute_definition
}
}