pub struct Schema {
pub spec: SchemaSpec,
pub top_node_type: Option<NodeType>,
pub cached: Arc<Mutex<HashMap<String, Arc<dyn Any + Send + Sync>>>>,
pub nodes: HashMap<String, NodeType>,
pub marks: HashMap<String, MarkType>,
}Expand description
Schema 结构体定义 用于管理文档模型的整体结构,包括节点和标记的类型定义
Fields§
§spec: SchemaSpecSchema 的规范定义
top_node_type: Option<NodeType>顶级节点类型
cached: Arc<Mutex<HashMap<String, Arc<dyn Any + Send + Sync>>>>全局缓存
nodes: HashMap<String, NodeType>节点类型映射表
marks: HashMap<String, MarkType>标记类型映射表
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn new(spec: SchemaSpec) -> Self
pub fn new(spec: SchemaSpec) -> Self
创建新的 Schema 实例
Sourcepub fn compile(instance_spec: SchemaSpec) -> PoolResult<Schema>
pub fn compile(instance_spec: SchemaSpec) -> PoolResult<Schema>
编译 Schema 定义 处理节点和标记的定义,建立它们之间的关系
Trait Implementations§
impl Eq for Schema
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnwindSafe for Schema
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<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