Skip to main content

ContextPacket

Struct ContextPacket 

Source
pub struct ContextPacket {
    pub content: String,
    pub included_ids: Vec<String>,
    pub omitted_ids: Vec<String>,
    pub raw_estimated_tokens: u32,
    pub selected_estimated_tokens: u32,
    pub omitted_estimated_tokens: u32,
    pub requires_upstream: bool,
    pub deduplicated_lines: u32,
    pub deduplicated_estimated_tokens: u32,
    pub token_breakdown: Option<TokenBreakdown>,
    pub packet_id: Option<String>,
    pub snapshot_id: Option<String>,
}

Fields§

§content: String§included_ids: Vec<String>§omitted_ids: Vec<String>§raw_estimated_tokens: u32

Estimated tokens of every candidate item, selected or not.

§selected_estimated_tokens: u32

Estimated tokens actually in ContextPacket::content.

§omitted_estimated_tokens: u32

Estimated tokens of the candidates left out, i.e. raw_estimated_tokens - selected_estimated_tokens.

This is not a measure of tokens saved. It counts evidence that was assembled and then dropped to fit the budget, which says nothing about what a consumer would otherwise have sent. It is zero whenever the budget fits everything, and it grows as the budget shrinks. Treat it as an omission volume; to claim a saving you need a measured baseline of what the alternative actually cost.

§requires_upstream: bool

True when any candidate was unverified or contradictory, so the packet must not be treated as settled.

§deduplicated_lines: u32

Lines removed because a higher-priority item already carried them.

Unlike ContextPacket::omitted_estimated_tokens this is a saving: the content still reaches the consumer, once instead of twice.

§deduplicated_estimated_tokens: u32

Estimated tokens those repeated lines would have cost.

§token_breakdown: Option<TokenBreakdown>

Split accounting for the counter that produced the numbers above.

§packet_id: Option<String>

Handle for the delivered body, selection, budget, and snapshot.

§snapshot_id: Option<String>

Tree the packet was compiled against, e.g. git:<commit>+dirty:<digest>.

Trait Implementations§

Source§

impl Clone for ContextPacket

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContextPacket

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ContextPacket

Source§

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 Eq for ContextPacket

Source§

impl PartialEq for ContextPacket

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ContextPacket

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ContextPacket

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.