pub struct NodeFactory<'schema> { /* private fields */ }Expand description
工厂负责基于 Schema 生成各类节点,复用 [NodeType] 的编译信息。
Implementations§
Source§impl<'schema> NodeFactory<'schema>
impl<'schema> NodeFactory<'schema>
Sourcepub fn create_node(
&self,
type_name: &str,
id: Option<NodeId>,
attrs: Option<&HashMap<String, Value>>,
content: Vec<NodeId>,
marks: Option<Vec<Mark>>,
) -> PoolResult<Node>
pub fn create_node( &self, type_name: &str, id: Option<NodeId>, attrs: Option<&HashMap<String, Value>>, content: Vec<NodeId>, marks: Option<Vec<Mark>>, ) -> PoolResult<Node>
按类型名称创建单节点。
Sourcepub fn node_definition(&self, type_name: &str) -> Option<&NodeDefinition>
pub fn node_definition(&self, type_name: &str) -> Option<&NodeDefinition>
获取节点类型定义引用,便于上层读取配置。
Sourcepub fn create_mark(
&self,
type_name: &str,
attrs: Option<&HashMap<String, Value>>,
) -> PoolResult<Mark>
pub fn create_mark( &self, type_name: &str, attrs: Option<&HashMap<String, Value>>, ) -> PoolResult<Mark>
按类型名称创建标记。
Sourcepub fn mark_definition(&self, type_name: &str) -> Option<&MarkDefinition>
pub fn mark_definition(&self, type_name: &str) -> Option<&MarkDefinition>
获取标记类型定义引用。
Trait Implementations§
Source§impl<'schema> Clone for NodeFactory<'schema>
impl<'schema> Clone for NodeFactory<'schema>
Source§fn clone(&self) -> NodeFactory<'schema>
fn clone(&self) -> NodeFactory<'schema>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'schema> Freeze for NodeFactory<'schema>
impl<'schema> RefUnwindSafe for NodeFactory<'schema>
impl<'schema> Send for NodeFactory<'schema>
impl<'schema> Sync for NodeFactory<'schema>
impl<'schema> Unpin for NodeFactory<'schema>
impl<'schema> UnwindSafe for NodeFactory<'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<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