pub struct MgHeader {
pub version: u8,
pub flags: u8,
pub grain_type: u8,
pub ns_hash: u16,
pub created_at_sec: u32,
}Expand description
The 9-byte fixed header for .mg blobs.
Fields§
§version: u8§flags: u8§grain_type: u8§ns_hash: u16§created_at_sec: u32Implementations§
Source§impl MgHeader
impl MgHeader
Sourcepub fn new(
grain_type: GrainType,
namespace: Option<&str>,
created_at_ms: i64,
) -> Self
pub fn new( grain_type: GrainType, namespace: Option<&str>, created_at_ms: i64, ) -> Self
Build header from grain metadata.
Sourcepub fn set_is_signed(&mut self, signed: bool)
pub fn set_is_signed(&mut self, signed: bool)
Set the is_signed flag (bit 0 of the flags byte).
Sourcepub fn set_has_content_refs(&mut self, has: bool)
pub fn set_has_content_refs(&mut self, has: bool)
Set flags for content_refs presence.
Sourcepub fn set_has_embedding_refs(&mut self, has: bool)
pub fn set_has_embedding_refs(&mut self, has: bool)
Set flags for embedding_refs presence.
Sourcepub fn set_ai_generated(&mut self, is_ai: bool)
pub fn set_ai_generated(&mut self, is_ai: bool)
Set AI-generated content flag (bit 5).
Sourcepub fn set_sensitivity(&mut self, level: u8)
pub fn set_sensitivity(&mut self, level: u8)
Set sensitivity level (bits 6-7).
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Parse from 9 bytes.
pub fn is_signed(&self) -> bool
pub fn is_encrypted(&self) -> bool
pub fn is_compressed(&self) -> bool
pub fn has_content_refs(&self) -> bool
pub fn has_embedding_refs(&self) -> bool
pub fn is_ai_generated(&self) -> bool
pub fn sensitivity(&self) -> u8
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MgHeader
impl RefUnwindSafe for MgHeader
impl Send for MgHeader
impl Sync for MgHeader
impl Unpin for MgHeader
impl UnsafeUnpin for MgHeader
impl UnwindSafe for MgHeader
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