Skip to main content

AgentServer

Struct AgentServer 

Source
pub struct AgentServer;
Expand description

Static functions for AgentServer management.

AgentServer hosts custom recognitions and actions that can be accessed remotely by AgentClient instances.

Implementations§

Source§

impl AgentServer

Source

pub fn register_custom_recognition( name: &str, reco: Box<dyn CustomRecognition>, ) -> MaaResult<()>

Register a custom recognition with the AgentServer.

The recognition will be available to connected AgentClients.

Source

pub fn register_custom_action( name: &str, action: Box<dyn CustomAction>, ) -> MaaResult<()>

Register a custom action with the AgentServer.

The action will be available to connected AgentClients.

Source

pub fn add_resource_sink<F>(callback: F) -> MaaResult<MaaSinkId>
where F: Fn(&str, &str) + Send + Sync + 'static,

Add a resource event sink.

Source

pub fn add_controller_sink<F>(callback: F) -> MaaResult<MaaSinkId>
where F: Fn(&str, &str) + Send + Sync + 'static,

Add a controller event sink.

Source

pub fn add_tasker_sink<F>(callback: F) -> MaaResult<MaaSinkId>
where F: Fn(&str, &str) + Send + Sync + 'static,

Add a tasker event sink.

Source

pub fn add_context_sink<F>(callback: F) -> MaaResult<MaaSinkId>
where F: Fn(&str, &str) + Send + Sync + 'static,

Add a context event sink.

Source

pub fn start_up(identifier: &str) -> MaaResult<()>

Start the AgentServer.

§Arguments
  • identifier - Connection identifier for clients to connect to
Source

pub fn shut_down()

Shut down the AgentServer.

Source

pub fn join()

Block until the server shuts down.

Source

pub fn detach()

Detach the server to run in background.

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.