pub struct Unit {
pub kind: UnitKind,
pub level: u8,
pub text: String,
pub markdown: String,
pub heading_path: Vec<String>,
pub position: usize,
pub tokens: usize,
}Expand description
One addressable block of an article.
This is the unit the context slimmer ranks, selects and emits, so it carries both its rendered Markdown and the plain text used for scoring.
Fields§
§kind: UnitKindBlock type.
level: u8Heading level (1–6), or list nesting depth.
text: StringPlain text, with Markdown syntax removed.
markdown: StringRendered Markdown for this block.
heading_path: Vec<String>Enclosing headings, outermost first — the breadcrumb a model needs to make sense of a block lifted out of its document.
position: usizeIndex in document order.
tokens: usizeEstimated LLM tokens for Unit::markdown.
Trait Implementations§
impl Eq for Unit
impl StructuralPartialEq for Unit
Auto Trait Implementations§
impl Freeze for Unit
impl RefUnwindSafe for Unit
impl Send for Unit
impl Sync for Unit
impl Unpin for Unit
impl UnsafeUnpin for Unit
impl UnwindSafe for Unit
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> ⓘ
Converts
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> ⓘ
Converts
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