pub struct Node {
pub id: NodeId,
pub type: String,
pub attrs: Attrs,
pub content: Vector<NodeId>,
pub marks: Vector<Mark>,
}Expand description
Fields§
§id: NodeId§type: String§attrs: Attrs§content: Vector<NodeId>§marks: Vector<Mark>Implementations§
Source§impl Node
impl Node
Sourcepub fn new(
id: &str,
type: String,
attrs: Attrs,
content: Vec<NodeId>,
marks: Vec<Mark>,
) -> Self
pub fn new( id: &str, type: String, attrs: Attrs, content: Vec<NodeId>, marks: Vec<Mark>, ) -> Self
Sourcepub fn child_count(&self) -> usize
pub fn child_count(&self) -> usize
Sourcepub fn update_attr(&self, new_values: HashMap<String, Value>) -> Self
pub fn update_attr(&self, new_values: HashMap<String, Value>) -> Self
Sourcepub fn insert_content_at_index(&self, index: usize, node_id: &str) -> Self
pub fn insert_content_at_index(&self, index: usize, node_id: &str) -> Self
Sourcepub fn insert_contents(&self, node_ids: &Vec<NodeId>) -> Self
pub fn insert_contents(&self, node_ids: &Vec<NodeId>) -> Self
Sourcepub fn insert_content(&self, node_id: &str) -> Self
pub fn insert_content(&self, node_id: &str) -> Self
Sourcepub fn remove_mark_by_name(&self, mark_name: &str) -> Self
pub fn remove_mark_by_name(&self, mark_name: &str) -> Self
Sourcepub fn remove_mark(&self, mark_types: &[String]) -> Self
pub fn remove_mark(&self, mark_types: &[String]) -> Self
Trait Implementations§
Source§impl<'a> Add<Node> for NodeRef<'a>
为 NodeRef 实现自定义的 + 运算符,用于添加单个节点
当使用 + 运算符时,会将新节点添加到当前节点的子节点列表中
impl<'a> Add<Node> for NodeRef<'a>
为 NodeRef 实现自定义的 + 运算符,用于添加单个节点 当使用 + 运算符时,会将新节点添加到当前节点的子节点列表中
Source§impl<'de> Deserialize<'de> for Node
impl<'de> Deserialize<'de> for Node
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> Shl<Node> for NodeRef<'a>
为 NodeRef 实现自定义的 << 运算符,用于在子节点列表开头插入单个节点
当使用 << 运算符时,会将新节点插入到当前节点的子节点列表的开头位置
impl<'a> Shl<Node> for NodeRef<'a>
为 NodeRef 实现自定义的 << 运算符,用于在子节点列表开头插入单个节点 当使用 << 运算符时,会将新节点插入到当前节点的子节点列表的开头位置
Source§impl<'a> Shr<Node> for NodeRef<'a>
为 NodeRef 实现自定义的 >> 运算符,用于在子节点列表末尾添加单个节点
当使用 >> 运算符时,会将新节点添加到当前节点的子节点列表的末尾位置
impl<'a> Shr<Node> for NodeRef<'a>
为 NodeRef 实现自定义的 >> 运算符,用于在子节点列表末尾添加单个节点 当使用 >> 运算符时,会将新节点添加到当前节点的子节点列表的末尾位置
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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