Skip to main content

ActionSet

Struct ActionSet 

Source
pub struct ActionSet<A>(/* private fields */);
Expand description

A typed collection of actions for a specific phase.

ActionSet<A> is the return type of all AgentBehavior hooks. It is the unit of composition: plugins can define named functions that return ActionSet<A> combining multiple core actions, and callers compose them with ActionSet::and.

[From<A> for ActionSet<A>] allows a single action to be returned anywhere an ActionSet<A> is expected, and [From<AnyStateAction> for A] is implemented for every phase action enum so state changes can be expressed without explicit wrapping.

Implementations§

Source§

impl<A> ActionSet<A>

Source

pub fn empty() -> Self

Empty set — default value, returned when a plugin does nothing.

Source

pub fn single(a: impl Into<A>) -> Self

Single-action set.

Source

pub fn and(self, other: impl Into<ActionSet<A>>) -> Self

Combine with another action set or anything that converts into one.

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn as_slice(&self) -> &[A]

Borrow the inner slice.

Source

pub fn into_vec(self) -> Vec<A>

Consume into the inner Vec.

Trait Implementations§

Source§

impl<A: Default> Default for ActionSet<A>

Source§

fn default() -> ActionSet<A>

Returns the “default value” for a type. Read more
Source§

impl<A> Extend<A> for ActionSet<A>

Source§

fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<AfterInferenceAction> for ActionSet<AfterInferenceAction>

Source§

fn from(a: AfterInferenceAction) -> Self

Converts to this type from the input type.
Source§

impl From<AfterToolExecuteAction> for ActionSet<AfterToolExecuteAction>

Source§

fn from(a: AfterToolExecuteAction) -> Self

Converts to this type from the input type.
Source§

impl From<AnyStateAction> for ActionSet<AfterInferenceAction>

Source§

fn from(sa: AnyStateAction) -> Self

Converts to this type from the input type.
Source§

impl From<AnyStateAction> for ActionSet<AfterToolExecuteAction>

Source§

fn from(sa: AnyStateAction) -> Self

Converts to this type from the input type.
Source§

impl From<AnyStateAction> for ActionSet<BeforeInferenceAction>

Source§

fn from(sa: AnyStateAction) -> Self

Converts to this type from the input type.
Source§

impl From<AnyStateAction> for ActionSet<BeforeToolExecuteAction>

Source§

fn from(sa: AnyStateAction) -> Self

Converts to this type from the input type.
Source§

impl From<AnyStateAction> for ActionSet<LifecycleAction>

Source§

fn from(sa: AnyStateAction) -> Self

Converts to this type from the input type.
Source§

impl From<BeforeInferenceAction> for ActionSet<BeforeInferenceAction>

Source§

fn from(a: BeforeInferenceAction) -> Self

Converts to this type from the input type.
Source§

impl From<BeforeToolExecuteAction> for ActionSet<BeforeToolExecuteAction>

Source§

fn from(a: BeforeToolExecuteAction) -> Self

Converts to this type from the input type.
Source§

impl From<LifecycleAction> for ActionSet<LifecycleAction>

Source§

fn from(a: LifecycleAction) -> Self

Converts to this type from the input type.
Source§

impl<A> From<Vec<A>> for ActionSet<A>

Source§

fn from(v: Vec<A>) -> Self

Converts to this type from the input type.
Source§

impl<A> IntoIterator for ActionSet<A>

Source§

type Item = A

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<A>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<A> Freeze for ActionSet<A>

§

impl<A> RefUnwindSafe for ActionSet<A>
where A: RefUnwindSafe,

§

impl<A> Send for ActionSet<A>
where A: Send,

§

impl<A> Sync for ActionSet<A>
where A: Sync,

§

impl<A> Unpin for ActionSet<A>
where A: Unpin,

§

impl<A> UnsafeUnpin for ActionSet<A>

§

impl<A> UnwindSafe for ActionSet<A>
where A: UnwindSafe,

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: 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: 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, 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