pub struct BlockMetadata {
pub semantic_role: Option<SemanticRole>,
pub label: Option<String>,
pub tags: Vec<String>,
pub summary: Option<String>,
pub token_estimate: Option<TokenEstimate>,
pub content_hash: ContentHash,
pub created_at: DateTime<Utc>,
pub modified_at: DateTime<Utc>,
pub custom: HashMap<String, Value>,
}Expand description
Block metadata
Fields§
§semantic_role: Option<SemanticRole>Semantic role in document structure
label: Option<String>Human-readable label
Searchable tags
summary: Option<String>Pre-computed summary for folding/context management
token_estimate: Option<TokenEstimate>Estimated token count (computed lazily)
content_hash: ContentHashContent hash for change detection
created_at: DateTime<Utc>Creation timestamp
modified_at: DateTime<Utc>Last modification timestamp
custom: HashMap<String, Value>Custom key-value metadata
Implementations§
Source§impl BlockMetadata
impl BlockMetadata
Sourcepub fn new(content_hash: ContentHash) -> Self
pub fn new(content_hash: ContentHash) -> Self
Create new metadata with current timestamp
Sourcepub fn with_role(self, role: SemanticRole) -> Self
pub fn with_role(self, role: SemanticRole) -> Self
Set semantic role
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Set label
Add multiple tags
Sourcepub fn with_summary(self, summary: impl Into<String>) -> Self
pub fn with_summary(self, summary: impl Into<String>) -> Self
Set summary
Sourcepub fn with_custom(self, key: impl Into<String>, value: Value) -> Self
pub fn with_custom(self, key: impl Into<String>, value: Value) -> Self
Set custom metadata
Trait Implementations§
Source§impl Clone for BlockMetadata
impl Clone for BlockMetadata
Source§fn clone(&self) -> BlockMetadata
fn clone(&self) -> BlockMetadata
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 BlockMetadata
impl Debug for BlockMetadata
Source§impl Default for BlockMetadata
impl Default for BlockMetadata
Source§impl<'de> Deserialize<'de> for BlockMetadata
impl<'de> Deserialize<'de> for BlockMetadata
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
Source§impl PartialEq for BlockMetadata
impl PartialEq for BlockMetadata
Source§impl Serialize for BlockMetadata
impl Serialize for BlockMetadata
impl StructuralPartialEq for BlockMetadata
Auto Trait Implementations§
impl Freeze for BlockMetadata
impl RefUnwindSafe for BlockMetadata
impl Send for BlockMetadata
impl Sync for BlockMetadata
impl Unpin for BlockMetadata
impl UnwindSafe for BlockMetadata
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