#[non_exhaustive]pub struct MessageMeta {
pub policy: CompactionPolicy,
pub source: Option<String>,
pub salience: Option<f64>,
pub version: u64,
}Expand description
Per-message annotation attached to every message in an OperatorContext.
All fields are public and directly settable. The Default implementation
uses CompactionPolicy::Normal and zeros/nones for everything else.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.policy: CompactionPolicyCompaction policy governing how this message survives context reduction.
source: Option<String>Source of the message, e.g. "user" or "tool:shell".
salience: Option<f64>Importance hint in the range 0.0–1.0. Higher values should survive compaction longer.
version: u64Monotonic version counter, incremented on each mutation via OperatorContext::transform.
Implementations§
Source§impl MessageMeta
impl MessageMeta
Sourcepub fn with_policy(policy: CompactionPolicy) -> Self
pub fn with_policy(policy: CompactionPolicy) -> Self
Create metadata with the given policy and defaults for all other fields.
Sourcepub fn set_source(self, source: impl Into<String>) -> Self
pub fn set_source(self, source: impl Into<String>) -> Self
Set the source.
Sourcepub fn set_salience(self, salience: f64) -> Self
pub fn set_salience(self, salience: f64) -> Self
Set the salience score.
Trait Implementations§
Source§impl Clone for MessageMeta
impl Clone for MessageMeta
Source§fn clone(&self) -> MessageMeta
fn clone(&self) -> MessageMeta
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 MessageMeta
impl Debug for MessageMeta
Source§impl Default for MessageMeta
impl Default for MessageMeta
Source§impl<'de> Deserialize<'de> for MessageMeta
impl<'de> Deserialize<'de> for MessageMeta
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
Auto Trait Implementations§
impl Freeze for MessageMeta
impl RefUnwindSafe for MessageMeta
impl Send for MessageMeta
impl Sync for MessageMeta
impl Unpin for MessageMeta
impl UnsafeUnpin for MessageMeta
impl UnwindSafe for MessageMeta
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