Struct DefaultTransport

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

A high-level wrapper around a low-level DynTxImp transport implementation.

Implementations§

Source§

impl DefaultTransport

Source

pub fn create(hnd: &TxImpHnd, imp: DynTxImp) -> DynTransport

When constructing a Transport from a TransportFactory, this function does the actual wrapping of your implemementation to produce the Transport struct.

DefaultTransport is built to be used with the provided TxImpHnd.

Trait Implementations§

Source§

impl Clone for DefaultTransport

Source§

fn clone(&self) -> DefaultTransport

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DefaultTransport

Source§

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

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

impl Transport for DefaultTransport

Source§

fn register_space_handler( &self, space: SpaceId, handler: DynTxSpaceHandler, ) -> Option<Url>

Register a space handler for receiving incoming notifications. Read more
Source§

fn register_module_handler( &self, space: SpaceId, module: String, handler: DynTxModuleHandler, )

Register a module handler for receiving incoming module messages. Read more
Source§

fn disconnect(&self, peer: Url, reason: Option<String>) -> BoxFut<'_, ()>

Make a best effort to notify a peer that we are disconnecting and why. After a short time out, the connection will be closed even if the disconnect reason message is still pending.
Source§

fn send_space_notify( &self, peer: Url, space: SpaceId, data: Bytes, ) -> BoxFut<'_, K2Result<()>>

Notify a remote peer within a space. This is a fire-and-forget type message. The future this call returns will indicate any errors that occur up to the point where the message is handed off to the transport backend. After that, the future will return Ok(()) but the remote peer may or may not actually receive the message.
Source§

fn send_module( &self, peer: Url, space: SpaceId, module: String, data: Bytes, ) -> BoxFut<'_, K2Result<()>>

Notify a remote peer module within a space. This is a fire-and-forget type message. The future this call returns will indicate any errors that occur up to the point where the message is handed off to the transport backend. After that, the future will return Ok(()) but the remote peer may or may not actually receive the message.
Source§

fn get_connected_peers(&self) -> BoxFut<'_, K2Result<Vec<Url>>>

Get the list of connected peers.
Source§

fn unregister_space(&self, space: SpaceId) -> BoxFut<'_, ()>

Unregister a space handler and all module handlers for that space.
Source§

fn dump_network_stats(&self) -> BoxFut<'_, K2Result<TransportStats>>

Dump network stats.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,