Net

Struct Net 

Source
pub struct Net<A: Address> { /* private fields */ }

Implementations§

Source§

impl<A: Address> Net<A>

Source

pub fn server() -> Net<A>

Source

pub fn client() -> Net<A>

Source

pub fn needs_tick(&self) -> Timeout

Source

pub fn is_receive_chunk_still_valid( &self, chunk: &mut ChunkOrEvent<'_, A>, ) -> bool

Source

pub fn connect<CB: Callback<A>>( &mut self, cb: &mut CB, addr: A, ) -> (PeerId, Result<(), CB::Error>)

Source

pub fn disconnect<CB: Callback<A>>( &mut self, cb: &mut CB, pid: PeerId, reason: &[u8], ) -> Result<(), CB::Error>

Source

pub fn send_connless<CB: Callback<A>>( &mut self, cb: &mut CB, addr: A, data: &[u8], ) -> Result<(), Error<CB::Error>>

Source

pub fn send<CB: Callback<A>>( &mut self, cb: &mut CB, chunk: Chunk<'_>, ) -> Result<(), Error<CB::Error>>

Source

pub fn flush<CB: Callback<A>>( &mut self, cb: &mut CB, pid: PeerId, ) -> Result<(), CB::Error>

Source

pub fn ignore(&mut self, pid: PeerId)

Source

pub fn accept<CB: Callback<A>>( &mut self, cb: &mut CB, pid: PeerId, ) -> Result<(), CB::Error>

Source

pub fn reject<CB: Callback<A>>( &mut self, cb: &mut CB, pid: PeerId, reason: &[u8], ) -> Result<(), CB::Error>

Source

pub fn tick<'a, CB: Callback<A>>( &'a mut self, cb: &'a mut CB, ) -> Tick<'_, A, CB>

Source

pub fn feed<'a, CB, B, W>( &mut self, cb: &mut CB, warn: &mut W, addr: A, data: &'a [u8], buf: B, ) -> (ReceivePacket<'a, A>, Result<(), CB::Error>)
where CB: Callback<A>, B: Buffer<'a>, W: Warn<Warning<A>>,

Auto Trait Implementations§

§

impl<A> Freeze for Net<A>

§

impl<A> RefUnwindSafe for Net<A>
where A: RefUnwindSafe,

§

impl<A> Send for Net<A>
where A: Send,

§

impl<A> Sync for Net<A>
where A: Sync,

§

impl<A> Unpin for Net<A>
where A: Unpin,

§

impl<A> UnwindSafe for Net<A>
where A: UnwindSafe,

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.