Connection

Struct Connection 

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

An active connection, on which requests can be executed, and responses received.

The request/response mechanism is serial, so if a request is made before the response from the previous one has been fully received, you’ll get a Error::OperationInProgress error.

Implementations§

Source§

impl Connection

Source

pub async fn send_request(&mut self, request: &str) -> Result<Vec<Message>>

Sends a request to the server and gets a vec of response messages. The terminating Message::Ok is not included.

Source

pub async fn show_interfaces_summary(&mut self) -> Result<Vec<InterfaceSummary>>

Sends a show interfaces summary request and returns the parsed response as a list of InterfaceSummary entries, one each for an interface.

Source

pub async fn show_interfaces(&mut self) -> Result<Vec<ShowInterfacesMessage>>

Sends a show interfaces request and returns the parsed response as a list of ShowInterfacesMessage entries, one each for an interface.

Source

pub async fn show_protocols( &mut self, pattern: Option<&str>, ) -> Result<Vec<Protocol>>

Sends a show protocols [<pattern>] request and returns the parsed response as a list of InterfaceSummary entries, one for each protocol.

If pattern is specified, results of only those protocols is returned, which match the pattern.

Source

pub async fn show_protocols_details( &mut self, pattern: Option<&str>, ) -> Result<Vec<ShowProtocolDetailsMessage>>

Sends a show protocols all [<pattern>] request and returns the parsed response as a list of ShowProtocolDetailsMessage entries, one for each protocol instance.

If pattern is specified, results of only those protocols is returned, which match the pattern.

Source

pub async fn show_status(&mut self) -> Result<ShowStatusMessage>

Sends a show status request, and returns a semantically parsed response in the form of ShowStatusMessage

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.