pub struct Connection { /* private fields */ }Expand description
A connection to the Theater server with automatic reconnection
Implementations§
Source§impl Connection
impl Connection
pub fn new(address: SocketAddr, config: Config) -> Self
Sourcepub async fn ensure_connected(&mut self) -> CliResult<()>
pub async fn ensure_connected(&mut self) -> CliResult<()>
Ensure we have an active connection, reconnecting if necessary
Sourcepub async fn send_command(
&mut self,
command: ManagementCommand,
) -> CliResult<ManagementResponse>
pub async fn send_command( &mut self, command: ManagementCommand, ) -> CliResult<ManagementResponse>
Send a command and wait for a response
Sourcepub async fn send_command_no_response(
&mut self,
command: ManagementCommand,
) -> CliResult<()>
pub async fn send_command_no_response( &mut self, command: ManagementCommand, ) -> CliResult<()>
Send a command without waiting for a response
Sourcepub async fn next_response(&mut self) -> CliResult<Option<ManagementResponse>>
pub async fn next_response(&mut self) -> CliResult<Option<ManagementResponse>>
Get the next response from the connection (for streaming operations)
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if the connection is currently active
Sourcepub fn address(&self) -> SocketAddr
pub fn address(&self) -> SocketAddr
Get the server address
Sourcepub fn last_error(&self) -> Option<&str>
pub fn last_error(&self) -> Option<&str>
Get the last connection error, if any
Trait Implementations§
Source§impl Debug for Connection
impl Debug for Connection
Auto Trait Implementations§
impl !Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnwindSafe for Connection
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more