pub struct NodeType {
pub name: String,
pub spec: NodeSpec,
pub desc: String,
pub groups: Vec<String>,
pub attrs: HashMap<String, Attribute>,
pub default_attrs: HashMap<String, Value>,
pub content_match: Option<ContentMatch>,
pub mark_set: Option<Vec<MarkType>>,
}Expand description
用于描述节点类型的行为规则和属性约束,通过Schema进行统一管理
Fields§
§name: String节点类型的唯一标识符(例如:“dw”, “dxgc”)
spec: NodeSpec节点类型的详细配置规范
desc: String节点类型的描述信息
groups: Vec<String>节点所属的逻辑分组
attrs: HashMap<String, Attribute>节点支持的属性集合(属性名 -> 属性定义)
default_attrs: HashMap<String, Value>节点属性的默认值集合
content_match: Option<ContentMatch>内容匹配规则,定义允许的子节点结构
mark_set: Option<Vec<MarkType>>允许附加的Mark类型集合
Implementations§
Source§impl NodeType
impl NodeType
Sourcepub fn check_content(&self, content: &[Node], schema: &Schema) -> bool
pub fn check_content(&self, content: &[Node], schema: &Schema) -> bool
Sourcepub fn check_attrs(&self, values: &Attrs)
pub fn check_attrs(&self, values: &Attrs)
Sourcepub fn has_required_attrs(&self) -> bool
pub fn has_required_attrs(&self) -> bool
检查节点是否包含必须的属性
Trait Implementations§
impl Eq for NodeType
impl StructuralPartialEq for NodeType
Auto Trait Implementations§
impl Freeze for NodeType
impl RefUnwindSafe for NodeType
impl Send for NodeType
impl Sync for NodeType
impl Unpin for NodeType
impl UnwindSafe for NodeType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more