pub struct Document {
pub meta: DocumentMeta,
pub frontmatter: FrontMatter,
pub content: String,
pub rendered_content: Option<String>,
pub span: Span,
}Expand description
文档
Fields§
§meta: DocumentMeta文档元信息
frontmatter: FrontMatter前置元数据(frontmatter)
content: String文档内容(原始文本)
rendered_content: Option<String>解析后的内容(可以是 HTML 或结构化数据)
span: Span位置信息
Implementations§
Source§impl Document
impl Document
Sourcepub fn with_frontmatter(self, frontmatter: FrontMatter) -> Document
pub fn with_frontmatter(self, frontmatter: FrontMatter) -> Document
设置前置元数据
Sourcepub fn with_content(self, content: String) -> Document
pub fn with_content(self, content: String) -> Document
设置文档内容
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
获取文档描述
获取文档标签
Sourcepub fn to_json_pretty(&self) -> Result<String, Error>
pub fn to_json_pretty(&self) -> Result<String, Error>
序列化为美化的 JSON
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Document
impl<'de> Deserialize<'de> for Document
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Document, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Document, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Document
impl Serialize for Document
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnsafeUnpin for Document
impl UnwindSafe for Document
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