pub struct DocumentBlock {
pub title: String,
pub content: Vec<u8>,
pub format_hint: FormatHint,
}Expand description
DOCUMENT block — represents prose or documentation content.
Used for READMEs, design docs, comments, or any non-code textual
content that provides context to the LLM. The format_hint tells
the renderer how to interpret the body (markdown, plain text, HTML).
Field layout within body:
┌──────────┬───────────┬─────────────┬──────────────────────────┐
│ Field ID │ Wire Type │ Name │ Description │
├──────────┼───────────┼─────────────┼──────────────────────────┤
│ 1 │ Bytes │ title │ Document title │
│ 2 │ Bytes │ content │ Document body │
│ 3 │ Varint │ format_hint │ FormatHint enum byte │
└──────────┴───────────┴─────────────┴──────────────────────────┘Fields§
§title: String§content: Vec<u8>§format_hint: FormatHintImplementations§
Source§impl DocumentBlock
impl DocumentBlock
Sourcepub fn encode_body(&self) -> Vec<u8> ⓘ
pub fn encode_body(&self) -> Vec<u8> ⓘ
Serialize this block’s fields into a TLV-encoded body.
Sourcepub fn decode_body(buf: &[u8]) -> Result<Self, TypeError>
pub fn decode_body(buf: &[u8]) -> Result<Self, TypeError>
Deserialize a DOCUMENT block from a TLV-encoded body.
Trait Implementations§
Source§impl Clone for DocumentBlock
impl Clone for DocumentBlock
Source§fn clone(&self) -> DocumentBlock
fn clone(&self) -> DocumentBlock
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 DocumentBlock
impl Debug for DocumentBlock
Source§impl PartialEq for DocumentBlock
impl PartialEq for DocumentBlock
impl Eq for DocumentBlock
impl StructuralPartialEq for DocumentBlock
Auto Trait Implementations§
impl Freeze for DocumentBlock
impl RefUnwindSafe for DocumentBlock
impl Send for DocumentBlock
impl Sync for DocumentBlock
impl Unpin for DocumentBlock
impl UnsafeUnpin for DocumentBlock
impl UnwindSafe for DocumentBlock
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