Skip to main content

SpendNode

Struct SpendNode 

Source
pub struct SpendNode { /* private fields */ }
Expand description

What one turn, goal, task or session has spent and the engine’s ceiling on it, with the node above it that it spends into as well.

A turn’s own calls, those made on its side (compaction, memory, web extraction) and those of the delegates it started all spend into its node: a delegate’s turn sits under the turn that started it, and keeps spending into it after that turn has ended. A root turn sits under its goal, for a goal round, and its session.

Implementations§

Source§

impl SpendNode

Source

pub fn session(limit: Option<u64>) -> Self

Source

pub fn goal(limit: Option<u64>, session: Arc<SpendNode>) -> Self

Source

pub fn task(limit: Option<u64>, session: Arc<SpendNode>) -> Self

A host sub-agent’s own ceiling. Never under a turn: a turn’s delegated counts only through the turns directly under it.

Source

pub fn turn(limit: Option<u64>, above: Option<Arc<SpendNode>>) -> Self

A root turn under its goal or session, or a delegate’s under the turn that started it.

Source

pub fn counting_into(self, session: Arc<SpendNode>) -> Self

A delegate turn that also counts into session, its own.

Source

pub fn scope(&self) -> Scope

Source

pub fn limit(&self) -> Option<u64>

Source

pub fn set_limit(&self, limit: Option<u64>)

Source

pub fn add(&self, call: Usage)

One call, made by this node’s agent or on its side.

Source

pub fn read(&self) -> Spend

This node, everything under it included.

Source

pub fn delegated(&self) -> Spend

The part of a turn’s Self::read its delegates spent.

Source

pub fn restore(&self, spent: Spend)

Start from what the session log recorded, before anything spends.

Source

pub fn whole_turn(&self) -> Spend

The root turn and every delegate under it; for a node that is not a turn, its own reading.

Source

pub fn find(&self, scope: Scope) -> Option<&SpendNode>

The nearest node up the chain, this one included, that is scope’s.

Source

pub fn remaining(&self) -> Option<(Scope, Remaining)>

What is left under the tightest ceiling up the chain, and whose it is; None with no ceiling.

Source

pub fn judge(&self) -> (Scope, Spending)

Whether to keep spending under the ceilings up the chain: the first one reached ends the turn, and the nearest one past 90% has the model told to wrap up.

Trait Implementations§

Source§

impl Debug for SpendNode

Source§

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

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

impl Default for SpendNode

Source§

fn default() -> Self

Returns the “default value” for a type. 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, 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.
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