pub struct Chunk {
pub text: String,
pub heading_path: Vec<String>,
pub source: Option<String>,
pub byte_range: (usize, usize),
pub hash: String,
}Expand description
One RAG chunk.
The field names are the public JSON schema (docs/PRD/02-cli-spec.md).
source repeats the document path on purpose: chunks are usually flattened
into a vector store one by one, and a chunk that cannot say where it came
from is a citation you cannot follow back.
Fields§
§text: String§heading_path: Vec<String>Enclosing headings, outermost first (["Introduction", "Method"]).
source: Option<String>Path the document was read from, when it is known.
byte_range: (usize, usize)Byte range of the chunk inside the rendered Markdown.
hash: StringContent hash, "sha256:<hex>" — see chunk_hash.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Chunk
impl<'de> Deserialize<'de> for Chunk
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 Chunk
Auto Trait Implementations§
impl Forget for Chunk
impl Freeze for Chunk
impl Move for Chunk
impl RefUnwindSafe for Chunk
impl Send for Chunkwhere
RawVecInner: Send,
impl Sync for Chunkwhere
RawVecInner: Sync,
impl Unpin for Chunk
impl UnsafeUnpin for Chunkwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
impl UnwindSafe for Chunkwhere
RawVecInner: UnwindSafe,
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