pub struct Manager { /* private fields */ }Expand description
Structure that represents the Manager. Represents a manager that handles connections and options.
§Fields
options- Configuration options for the manager.connection- An optional TCP stream representing the connection.authenticated- Indicates whether the manager is authenticated. This field is currently unused.emitter- A thread-safe vector of strings used for emitting events or messages.
Implementations§
Source§impl Manager
impl Manager
Sourcepub fn new(
options: ManagerOptions,
event_sender: Option<Sender<String>>,
_event_callback: Option<Box<dyn Fn(Value) + Send + Sync>>,
) -> Self
pub fn new( options: ManagerOptions, event_sender: Option<Sender<String>>, _event_callback: Option<Box<dyn Fn(Value) + Send + Sync>>, ) -> Self
Creates a new instance of the Manager.
Sourcepub async fn connect_with_retries(&mut self)
pub async fn connect_with_retries(&mut self)
Connects to the AMI server with reconnection logic.
Sourcepub async fn send_action(&mut self, action: Value) -> Result<(), String>
pub async fn send_action(&mut self, action: Value) -> Result<(), String>
Sends an action to the AMI server.
Sourcepub async fn read_data_with_retries(&mut self)
pub async fn read_data_with_retries(&mut self)
Reads data from the AMI server with reconnection logic.
Sourcepub async fn on_event(&mut self, event: String, event_type: &str)
pub async fn on_event(&mut self, event: String, event_type: &str)
Processes an event received from the AMI server.
Sourcepub fn parse_event(&self, data: &str) -> Result<Value, String>
pub fn parse_event(&self, data: &str) -> Result<Value, String>
Parses an event received from the AMI server.
Sourcepub async fn disconnect(&mut self)
pub async fn disconnect(&mut self)
Disconnects from the AMI server.
Sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Returns whether the manager is authenticated.
Auto Trait Implementations§
impl !Freeze for Manager
impl !RefUnwindSafe for Manager
impl Send for Manager
impl Sync for Manager
impl Unpin for Manager
impl !UnwindSafe for Manager
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