Connection

Struct Connection 

Source
pub struct Connection<B: Driver> { /* private fields */ }
Expand description

explicit messaging connection

Implementations§

Source§

impl<B: Driver<Endpoint = SocketAddrV4>> Connection<B>

Source

pub async fn new_host_lookup( host: impl AsRef<str>, options: OpenOptions, ) -> Result<Self>

create connection from specified host, with default port if port not specified

Source§

impl<B: Driver> Connection<B>

Source

pub fn new(addr: B::Endpoint, options: OpenOptions) -> Self

Create connection

Source

pub fn remote_endpoint(&self) -> &B::Endpoint

current remote endpoint, driver specific

Source

pub fn connection_id(&self) -> Option<u32>

CIP connection id

Source

pub fn connected(&self) -> bool

is CIP connection built?

Source

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

close current connection and open a new connection

Trait Implementations§

Source§

impl<B: Debug + Driver> Debug for Connection<B>
where B::Endpoint: Debug, B::Service: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B: Driver> Heartbeat for Connection<B>

Source§

fn heartbeat<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

send Heartbeat message to keep underline transport alive

Source§

type Error = ClientError

Source§

impl<B: Driver> MessageService for Connection<B>

Source§

fn send<'de, 'life0, 'async_trait, P, D, R>( &'life0 mut self, mr: MessageRequest<P, D>, ) -> Pin<Box<dyn Future<Output = Result<R>> + Send + 'async_trait>>
where P: Encode + Send + Sync + 'async_trait, D: Encode + Send + Sync + 'async_trait, R: MessageReplyInterface + Decode<'de> + 'static + 'async_trait, Self: 'async_trait, 'de: 'async_trait, 'life0: 'async_trait,

connected send

Source§

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

close current connection and underline transport

Source§

fn closed(&self) -> bool

is connection closed?

Source§

type Error = ClientError

Auto Trait Implementations§

§

impl<B> !Freeze for Connection<B>

§

impl<B> RefUnwindSafe for Connection<B>

§

impl<B> Send for Connection<B>

§

impl<B> Sync for Connection<B>

§

impl<B> Unpin for Connection<B>
where <B as Driver>::Endpoint: Unpin, <B as Driver>::Service: Unpin,

§

impl<B> UnwindSafe for Connection<B>

Blanket Implementations§

Source§

impl<T> AbTemplateService for T
where T: MessageService<Error = ClientError>,

Source§

fn find_template<'life0, 'async_trait>( &'life0 mut self, instance_id: u16, ) -> Pin<Box<dyn Future<Output = Result<Template, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait,

fetch template instance for specified instance id

Source§

fn read_template<'a>(&'a mut self, template: &Template) -> TemplateRead<'a, T>

read template definition

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> CommonServices for T
where T: MessageService,

Source§

fn get_attribute_all<'de, 'life0, 'async_trait, R>( &'life0 mut self, path: EPath, ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where 'de: 'async_trait, 'life0: 'async_trait, R: Decode<'de> + 'static + 'async_trait, Self: Send + 'async_trait,

invoke the Get_Attribute_All service
Source§

fn set_attribute_all<'life0, 'async_trait, D>( &'life0 mut self, path: EPath, attrs: D, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, D: Encode + Send + Sync + 'async_trait, Self: Send + 'async_trait,

invoke the Set_Attribute_All service
Source§

fn get_attribute_list<'de, 'life0, 'life1, 'async_trait, R>( &'life0 mut self, path: EPath, attrs: &'life1 [u16], ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where 'de: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, R: Decode<'de> + 'static + 'async_trait, Self: Send + 'async_trait,

invoke the Get_Attribute_List
Source§

fn set_attribute_list<'de, 'life0, 'async_trait, D, R>( &'life0 mut self, path: EPath, attrs: D, ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where 'de: 'async_trait, 'life0: 'async_trait, D: Encode + Send + Sync + 'async_trait, R: Decode<'de> + 'static + 'async_trait, Self: Send + 'async_trait,

invoke the Set_Attribute_List service
Source§

fn reset<'life0, 'async_trait>( &'life0 mut self, path: EPath, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Send + 'async_trait,

invoke the Reset service
Source§

fn start<'life0, 'async_trait>( &'life0 mut self, path: EPath, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Send + 'async_trait,

invoke the Start service
Source§

fn stop<'life0, 'async_trait>( &'life0 mut self, path: EPath, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Send + 'async_trait,

invoke the Stop service
Source§

fn create<'de, 'life0, 'async_trait, D, R>( &'life0 mut self, path: EPath, data: D, ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where 'de: 'async_trait, 'life0: 'async_trait, D: Encode + Send + Sync + 'async_trait, R: Decode<'de> + 'static + 'async_trait, Self: Send + 'async_trait,

invoke the Create service
Source§

fn delete<'life0, 'async_trait>( &'life0 mut self, path: EPath, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Send + 'async_trait,

invoke the Delete service
Source§

fn apply_attributes<'de, 'life0, 'async_trait, D, R>( &'life0 mut self, path: EPath, data: D, ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where 'de: 'async_trait, 'life0: 'async_trait, D: Encode + Send + Sync + 'async_trait, R: Decode<'de> + 'static + 'async_trait, Self: Send + 'async_trait,

invoke the Apply_Attributes service
Source§

fn get_attribute_single<'de, 'life0, 'async_trait, R>( &'life0 mut self, path: EPath, ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where 'de: 'async_trait, 'life0: 'async_trait, R: Decode<'de> + 'static + 'async_trait, Self: Send + 'async_trait,

invoke the Get_Attribute_Single service
Source§

fn set_attribute_single<'life0, 'async_trait, D>( &'life0 mut self, path: EPath, data: D, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, D: Encode + Send + Sync + 'async_trait, Self: Send + 'async_trait,

invoke the Set_Attribute_Single service
Source§

fn restore<'life0, 'async_trait>( &'life0 mut self, path: EPath, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Send + 'async_trait,

invoke the Restore service
Source§

fn save<'life0, 'async_trait>( &'life0 mut self, path: EPath, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Send + 'async_trait,

invoke the Save service
Source§

fn no_operation<'life0, 'async_trait>( &'life0 mut self, path: EPath, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Send + 'async_trait,

invoke the Nop service
Source§

fn get_member<'de, 'life0, 'async_trait, R>( &'life0 mut self, path: EPath, ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where 'de: 'async_trait, 'life0: 'async_trait, R: Decode<'de> + 'static + 'async_trait, Self: Send + 'async_trait,

invoke the Get_Member service
Source§

fn set_member<'de, 'life0, 'async_trait, D, R>( &'life0 mut self, path: EPath, data: D, ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where 'de: 'async_trait, 'life0: 'async_trait, D: Encode + Send + Sync + 'async_trait, R: Decode<'de> + 'static + 'async_trait, Self: Send + 'async_trait,

invoke the Set_Member service
Source§

fn insert_member<'de, 'life0, 'async_trait, D, R>( &'life0 mut self, path: EPath, data: D, ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where 'de: 'async_trait, 'life0: 'async_trait, D: Encode + Send + Sync + 'async_trait, R: Decode<'de> + 'static + 'async_trait, Self: Send + 'async_trait,

invoke the Insert_Member service
Source§

fn remove_member<'life0, 'async_trait>( &'life0 mut self, path: EPath, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Send + 'async_trait,

invoke the Remove_Member service
Source§

fn group_sync<'life0, 'async_trait>( &'life0 mut self, path: EPath, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Send + 'async_trait,

invoke the Group_Sync service
Source§

fn multiple_service<P, D>(&mut self) -> MultipleServicePacket<'_, Self, P, D>
where Self: Sized, P: Encode, D: Encode,

multiple service packet
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V