Struct OutputAgent

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

Actor-like, dedicated worker thread that handles writing to an output stream. Accepts tasks as messages, which are executed by the agent.

Note that the OutputAgent type is not meant to be Sync, it is meant to be synchronized externally, or more typically, used by one controlling thread only.

Implementations§

Source§

impl OutputAgent

Source

pub fn start_with_provider<OUT, OUT_P>( msg_writer_provider: OUT_P, ) -> OutputAgent
where OUT: MessageWriter + 'static, OUT_P: FnOnce() -> OUT + Send + 'static,

Source

pub fn start<AGENT_RUNNER>(agent_runner: AGENT_RUNNER) -> OutputAgent
where AGENT_RUNNER: AgentRunnable + Send + 'static,

Source

pub fn is_shutdown(&self) -> bool

Source

pub fn try_submit_task( &self, task: OutputAgentTask, ) -> Result<(), SendError<OutputAgentMessage>>

Source

pub fn submit_task(&self, task: OutputAgentTask)

Source

pub fn request_shutdown(&mut self)

Source

pub fn shutdown_and_soft_join(&mut self) -> Result<()>

Source

pub fn shutdown_and_join(&mut self)

Trait Implementations§

Source§

impl Drop for OutputAgent

Source§

fn drop(&mut self)

Executes the destructor for this 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, 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 = 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.