Struct vlink::TcpBridge

source ·
pub struct TcpBridge { /* private fields */ }

Implementations§

source§

impl TcpBridge

constructors

source

pub async fn accepting_from(port: u16) -> TcpBridge

Creates a listening TcpBridge which accepts connections to port

Cancel safety

This method is to be assumed not cancel safe. The cancel safety of this method cannot be garanteed since the underlying bind future does not make any statements about cancel safety

source

pub fn emit_to(port: u16) -> TcpBridge

Creates an emitting TcpBridge which emits connections to port

source§

impl TcpBridge

extract logic

source

pub async fn extract<'a>(&mut self, buf: &'a mut [u8]) -> Action<'a>

Wait for an action to occur which can the transfered to the other half of this Bridge

Cancel safety

This method is cancel safe. After a returning action has been selected all internal futures will be dropped. Underlying futures are all cancel safe, hence this function may be used in tokio::select

source§

impl TcpBridge

input logic

source

pub async fn input<'a>(&mut self, action: Action<'a>) -> Action<'_>

Inputs an action produced by the other half of this Bridge

Cancel safety

This method is not cancellation safe. If it is used as the event in a tokio::select statement and some other branch completes first, then the provided action may have been partially executed, but future calls to input will start over with the action

source

pub fn input_error(&mut self, v_port: u16, _err: Error)

source§

impl TcpBridge

info getters

source

pub fn port(&self) -> u16

source

pub fn is_listening(&self) -> bool

source

pub fn active_connections(&self) -> usize

source

pub fn is_closed(&self) -> bool

source

pub fn close(&mut self)

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.