pub struct BriefContext {
pub turn: u64,
pub goal: Option<String>,
pub user_message: Option<String>,
pub budget: TokenBudget,
pub now: SystemTime,
}Expand description
Per-turn input handed to every crate::source::Source.
Sources read from ctx to decide what to contribute. turn, goal, and
user_message are caller-supplied; budget is informational here
(enforcement is the builder’s job); now lets sources timestamp without
reaching for the clock directly, which keeps tests deterministic.
Fields§
§turn: u64Turn number within the current session. Monotonically increasing.
goal: Option<String>Optional running goal carried across turns.
user_message: Option<String>The user’s latest message, if any.
budget: TokenBudgetToken budget for this turn.
now: SystemTimeWall-clock time the builder considers “now”. Sources should prefer
this over SystemTime::now() so tests are reproducible.
Implementations§
Source§impl BriefContext
impl BriefContext
Sourcepub fn new(budget: TokenBudget) -> Self
pub fn new(budget: TokenBudget) -> Self
Construct a BriefContext with the supplied budget and
now = SystemTime::now(). The remaining optional fields default to
None / 0.
Sourcepub fn with_user_message(self, message: impl Into<String>) -> Self
pub fn with_user_message(self, message: impl Into<String>) -> Self
Set the user message.
Sourcepub fn with_now(self, now: SystemTime) -> Self
pub fn with_now(self, now: SystemTime) -> Self
Override now (used in tests for deterministic time).
Trait Implementations§
Source§impl Clone for BriefContext
impl Clone for BriefContext
Source§fn clone(&self) -> BriefContext
fn clone(&self) -> BriefContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BriefContext
impl Debug for BriefContext
Source§impl<'de> Deserialize<'de> for BriefContext
impl<'de> Deserialize<'de> for BriefContext
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>,
Source§impl PartialEq for BriefContext
impl PartialEq for BriefContext
Source§fn eq(&self, other: &BriefContext) -> bool
fn eq(&self, other: &BriefContext) -> bool
self and other values to be equal, and is used by ==.