pub struct RawNode {
pub title: String,
pub content: String,
pub level: usize,
pub line_start: usize,
pub line_end: usize,
pub page: Option<usize>,
pub token_count: Option<usize>,
pub total_token_count: Option<usize>,
}Expand description
A raw node extracted from a document.
This represents a section or element before it’s organized into a tree. Raw nodes are produced by parsers and consumed by the indexer.
Fields§
§title: StringTitle or heading of this node.
content: StringText content of this node (including all children’s content).
level: usizeLevel in the hierarchy (0 = root, 1 = top-level section, etc.).
line_start: usizeLine number where this node starts (1-based).
line_end: usizeLine number where this node ends (1-based).
page: Option<usize>Page number for PDF documents (1-based).
token_count: Option<usize>Estimated token count for this node’s own content.
total_token_count: Option<usize>Total token count including all children (recursive, computed by thinner).
Implementations§
Source§impl RawNode
impl RawNode
Sourcepub fn with_content(self, content: impl Into<String>) -> Self
pub fn with_content(self, content: impl Into<String>) -> Self
Set the content of this node.
Sourcepub fn with_level(self, level: usize) -> Self
pub fn with_level(self, level: usize) -> Self
Set the level of this node.
Sourcepub fn with_lines(self, start: usize, end: usize) -> Self
pub fn with_lines(self, start: usize, end: usize) -> Self
Set the line range of this node.
Sourcepub fn has_content(&self) -> bool
pub fn has_content(&self) -> bool
Check if this node has any content.
Sourcepub fn char_count(&self) -> usize
pub fn char_count(&self) -> usize
Get the character count of the content.
Sourcepub fn word_count(&self) -> usize
pub fn word_count(&self) -> usize
Get the word count (approximate) of the content.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RawNode
impl<'de> Deserialize<'de> for RawNode
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>,
Auto Trait Implementations§
impl Freeze for RawNode
impl RefUnwindSafe for RawNode
impl Send for RawNode
impl Sync for RawNode
impl Unpin for RawNode
impl UnsafeUnpin for RawNode
impl UnwindSafe for RawNode
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
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> 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>
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>
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