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) -> Self
pub fn with_frontmatter(self, frontmatter: FrontMatter) -> Self
设置前置元数据
Sourcepub fn with_content(self, content: String) -> Self
pub fn with_content(self, content: String) -> Self
设置文档内容
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
获取文档描述
获取文档标签
Sourcepub fn to_json_pretty(&self) -> Result<String>
pub fn to_json_pretty(&self) -> Result<String>
序列化为美化的 JSON
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Document
impl<'de> Deserialize<'de> for Document
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
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