Skip to main content

FanOut

Struct FanOut 

Source
pub struct FanOut {
    pub outcomes: Vec<ProviderOutcome>,
}
Expand description

The result of fanning one query out across all capability-matching providers.

Fields§

§outcomes: Vec<ProviderOutcome>

One entry per provider that matched the query’s frame kinds, in registration order.

Implementations§

Source§

impl FanOut

Source

pub fn accepted_frames(&self) -> impl Iterator<Item = &ContextFrame>

Every frame from providers that passed the consent gate, the timeout, and the budget-honesty audit — the frames a host may honestly compose into a prompt.

Source

pub fn total_accepted_tokens(&self) -> u64

The summed honest token cost of every accepted frame.

Source

pub fn accepted_with_provider( &self, ) -> impl Iterator<Item = (&str, &ContextFrame)>

Every accepted frame paired with the id of the provider that served it — the input to deterministic composition (docs/context-reuse.md §1).

Source

pub fn compose(&self) -> String

Compose every accepted frame into a byte-stable context block via the deterministic composition contract — canonical order, relevance-free rendering (docs/context-reuse.md §1). Two fan-outs over the same frame set compose to identical bytes, so an unchanged turn extends the provider’s prompt cache instead of busting it.

Source

pub fn compose_for_prompt(&self, global_budget: u32) -> ComposedPrompt

Compose every accepted frame into a prompt-ready block via the reference composer (issue #15): the R3 evidence preamble, cross-provider-deduped and value-ordered fenced frames packed under global_budget, a citation map, and a CompositionAudit explaining every included and excluded frame. Pair with Host::query_all_budgeted: the fan-out splits the budget across providers, and this packs the survivors under the same whole so audit.tokens_used <= global_budget.

Source

pub fn usage_report( &self, query: &ContextQuery, as_of: impl Into<String>, ) -> UsageReport

Roll this fan-out up into a per-request UsageReport for metering (docs/context-reuse.md §2). One ProviderUsage per provider the query reached: accepted frames are itemized by stable identity and declared cost, a budget-lying provider’s dropped frames count as rejected, and a failed or consent-gated provider served nothing.

The report is a pure function of this fan-out plus the two host-supplied scalars: budget_requested is the query’s max_tokens, and as_of is the accounting snapshot time (an RFC 3339 string the host stamps — the report’s own as-of, not the query’s bi-temporal as_of pin). The result always satisfies UsageReport::is_consistent: its totals are summed from the same served frames it itemizes.

Source

pub fn failures(&self) -> impl Iterator<Item = (&str, &HostError)>

Providers that failed (error, timeout, or crash), with their errors.

Source

pub fn budget_liars(&self) -> impl Iterator<Item = &ProviderOutcome>

Providers whose frames were dropped for exceeding the query budget — the loud report the host must surface, never swallow (SPEC.md §7, B2).

Source

pub fn frame_floods(&self) -> impl Iterator<Item = &ProviderOutcome>

Providers whose frames were dropped for exceeding max_frames — the frame-count twin of budget_liars, surfaced loudly rather than silently truncated (SPEC.md §7, B4).

Trait Implementations§

Source§

impl Debug for FanOut

Source§

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

Formats the value using the given formatter. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more