pub struct MarkdownChunk {
pub content: String,
pub chunk_type: ChunkType,
pub heading_hierarchy: Vec<String>,
pub line_range: (usize, usize),
}Expand description
A single chunk of content from a markdown document.
Chunks are created by splitting the document at heading boundaries. Each chunk preserves its position in the document hierarchy and the line range it covers in the source file.
Fields§
§content: StringThe text content of this chunk.
chunk_type: ChunkTypeThe type of content this chunk contains.
heading_hierarchy: Vec<String>The heading hierarchy leading to this chunk.
For example, ["Introduction", "Getting Started"] means this chunk
is under an h1 “Introduction” and h2 “Getting Started”.
line_range: (usize, usize)The line range in the source file (1-indexed, inclusive).
(start_line, end_line) where both are inclusive.
Implementations§
Source§impl MarkdownChunk
impl MarkdownChunk
Sourcepub fn text(
content: impl Into<String>,
heading_hierarchy: Vec<String>,
line_range: (usize, usize),
) -> Self
pub fn text( content: impl Into<String>, heading_hierarchy: Vec<String>, line_range: (usize, usize), ) -> Self
Create a new text chunk.
Sourcepub fn code_block(
content: impl Into<String>,
language: Option<String>,
heading_hierarchy: Vec<String>,
line_range: (usize, usize),
) -> Self
pub fn code_block( content: impl Into<String>, language: Option<String>, heading_hierarchy: Vec<String>, line_range: (usize, usize), ) -> Self
Create a new code block chunk.
Sourcepub fn code_language(&self) -> Option<&str>
pub fn code_language(&self) -> Option<&str>
Get the language of a code block, if applicable.
Sourcepub fn context_string(&self) -> String
pub fn context_string(&self) -> String
Get a context string describing where this chunk is in the document.
Trait Implementations§
Source§impl Clone for MarkdownChunk
impl Clone for MarkdownChunk
Source§fn clone(&self) -> MarkdownChunk
fn clone(&self) -> MarkdownChunk
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 moreSource§impl Debug for MarkdownChunk
impl Debug for MarkdownChunk
Source§impl<'de> Deserialize<'de> for MarkdownChunk
impl<'de> Deserialize<'de> for MarkdownChunk
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
Auto Trait Implementations§
impl Freeze for MarkdownChunk
impl RefUnwindSafe for MarkdownChunk
impl Send for MarkdownChunk
impl Sync for MarkdownChunk
impl Unpin for MarkdownChunk
impl UnsafeUnpin for MarkdownChunk
impl UnwindSafe for MarkdownChunk
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request