pub enum SpawnRefusal {
AgentCap {
max: u32,
},
DepthCap {
max: u32,
requested: u32,
},
BudgetExhausted,
}Expand description
Why a spawn was refused by the containment boundary. Returned to the requesting agent as a typed tool result it can adapt to, never a panic.
use io_harness::{Containment, Ledger, SpawnRefusal};
// Room for two agents in the whole tree, and the root is already one of them.
let ledger = Ledger::new(&Containment::new(2, 2, 1, 1_000));
ledger.register_agent(1).expect("the first child fits");
// The second child does not. The parent agent is told, in a form it can act
// on — do the work itself, or narrow what it was going to delegate.
let refusal = ledger.register_agent(1).unwrap_err();
assert_eq!(refusal, SpawnRefusal::AgentCap { max: 2 });
assert_eq!(refusal.to_string(), "agent cap reached (2 agents)");
// `cap` is the short label the trace records, so an audit can count refusals
// by which boundary produced them without parsing the English above.
assert_eq!(refusal.cap(), "agents");
assert_eq!(SpawnRefusal::DepthCap { max: 1, requested: 2 }.cap(), "depth");Variants§
AgentCap
The tree already holds max_total_agents.
DepthCap
The child would nest past max_depth (counted from the root).
BudgetExhausted
The aggregate spend ceiling is already exhausted, so a new agent has no budget to run under.
Implementations§
Trait Implementations§
Source§impl Clone for SpawnRefusal
impl Clone for SpawnRefusal
Source§fn clone(&self) -> SpawnRefusal
fn clone(&self) -> SpawnRefusal
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SpawnRefusal
impl Debug for SpawnRefusal
Source§impl Display for SpawnRefusal
impl Display for SpawnRefusal
impl Eq for SpawnRefusal
Source§impl PartialEq for SpawnRefusal
impl PartialEq for SpawnRefusal
impl StructuralPartialEq for SpawnRefusal
Auto Trait Implementations§
impl Freeze for SpawnRefusal
impl RefUnwindSafe for SpawnRefusal
impl Send for SpawnRefusal
impl Sync for SpawnRefusal
impl Unpin for SpawnRefusal
impl UnsafeUnpin for SpawnRefusal
impl UnwindSafe for SpawnRefusal
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
Adds separators according to the given
SeparatorPolicy. Read moreSource§fn separate_with_commas(&self) -> String
fn separate_with_commas(&self) -> String
Inserts a comma every three digits from the right. Read more
Source§fn separate_with_spaces(&self) -> String
fn separate_with_spaces(&self) -> String
Inserts a space every three digits from the right. Read more
Source§fn separate_with_dots(&self) -> String
fn separate_with_dots(&self) -> String
Inserts a period every three digits from the right. Read more
Source§fn separate_with_underscores(&self) -> String
fn separate_with_underscores(&self) -> String
Inserts an underscore every three digits from the right. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.