pub struct Mark {
pub mark_type: String,
pub attrs: Option<Box<Map<String, Value>>>,
pub extra: Option<Box<Map<String, Value>>>,
}Expand description
A mark applied to a node (e.g. bold, italic, link).
Serde: type (required, string), then attrs (when Some), then extra;
same null/duplicate rules as Node.
Fields§
§mark_type: StringMark type, e.g. "bold".
attrs: Option<Box<Map<String, Value>>>Mark attributes (e.g. href for a link).
extra: Option<Box<Map<String, Value>>>Any unknown/extra fields, preserved verbatim (None = none).
Implementations§
Source§impl Mark
impl Mark
Sourcepub fn new(mark_type: impl Into<String>) -> Self
pub fn new(mark_type: impl Into<String>) -> Self
Create a mark of mark_type with no attrs.
use tiptap_rusty_parser::Mark;
let m = Mark::new("bold");
assert_eq!(m.mark_type, "bold");Sourcepub fn attr(self, key: impl Into<String>, value: impl Into<Value>) -> Self
pub fn attr(self, key: impl Into<String>, value: impl Into<Value>) -> Self
Builder: set one attr.
Sourcepub fn attrs_mut(&mut self) -> &mut Map<String, Value>
pub fn attrs_mut(&mut self) -> &mut Map<String, Value>
Mutable attrs map, creating it if absent.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Mark
impl<'de> Deserialize<'de> for Mark
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Mark, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Mark, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Mark
impl RefUnwindSafe for Mark
impl Send for Mark
impl Sync for Mark
impl Unpin for Mark
impl UnsafeUnpin for Mark
impl UnwindSafe for Mark
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