AgentConfig

Struct AgentConfig 

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

Configuration parameters required to initialize a new agent.

This struct encapsulates the essential settings for creating an agent instance, including its unique identity, its relationship within the agent hierarchy (parent), and its connection to the system message broker.

The agent’s identity is represented by an Ern, which supports hierarchical naming. If a parent agent is specified during configuration, the final Ern of the new agent will be derived by appending its base id to the parent’s Ern.

Implementations§

Source§

impl AgentConfig

Source

pub fn new( id: Ern, parent: Option<AgentHandle>, broker: Option<AgentHandle>, ) -> Result<AgentConfig>

Creates a new AgentConfig instance, potentially deriving a hierarchical ID.

This constructor configures a new agent. If a parent handle is provided, the agent’s final id (Ern) is constructed by appending the provided id segment to the parent’s Ern. If no parent is provided, the id is used directly.

§Arguments
  • id - The base identifier (Ern) for the agent. If parent is Some, this acts as the final segment appended to the parent’s ID. If parent is None, this becomes the agent’s root ID.
  • parent - An optional [ParentRef] (handle) to the supervising agent.
  • broker - An optional [BrokerRef] (handle) to the system message broker.
§Returns

Returns a Result containing the configured AgentConfig instance.

§Errors

Returns an error if parsing the parent’s ID string into an Ern fails when constructing a hierarchical ID.

Source

pub fn new_with_name(name: impl Into<String>) -> Result<AgentConfig>

Creates a new AgentConfig for a top-level agent with a root identifier.

This is a convenience function for creating an AgentConfig for an agent that has no parent (i.e., it’s a root agent in the hierarchy). The provided name is used to create a root Ern.

§Arguments
  • name - A string-like value that will be used as the root name for the agent’s Ern.
§Returns

Returns a Result containing the new AgentConfig instance with no parent or broker.

§Errors

Returns an error if creating the root Ern from the provided name fails (e.g., if the name is invalid according to Ern rules).

Trait Implementations§

Source§

impl Clone for AgentConfig

Source§

fn clone(&self) -> AgentConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentConfig

Source§

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

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

impl Default for AgentConfig

Source§

fn default() -> AgentConfig

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> ActonMessage for T
where T: Any + Send + Sync + Debug + DynClone + 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Implementation of as_any for the blanket impl.

Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Implementation of as_any_mut for the blanket impl.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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