[−][src]Struct rust_ipv8::networking::NetworkReceiver
A NetworkReceiver is another (see NetworkSender) wrapper for a socket.
However, this one also contains a list of Receivers which get notified whenever a new message is received. A NetworkReceiver can be started with the start method which starts a new thread, listening for any incoming message on the Address specified.
Methods
impl NetworkReceiver
[src]
pub fn new(receiving_address: &Address) -> Result<Self, Box<dyn Error>>
[src]
Creates a new NetworkReceiver. This creates a receiver socket and builds a new threadpool on which all messages are distributed.
pub fn start(self, configuration: &Config) -> JoinHandle<()>
[src]
Starts the NetworkReceiver. This spawns a new thread in which it will listen for incoming messages.
This method consumes self as it is transferred to the new thread. After this no Receivers can be added to it.
Returns a JoinHandle<()>
which can be used to block until the NetworkReceiver stops listening.
Under normal operation this never happens so this marks the end of the program.
pub fn add_receiver(&mut self, receiver: Box<dyn Receiver + Send + Sync>)
[src]
Adds a receiver to the networkmanager. Can only happen before the networkmanager is started.
Auto Trait Implementations
impl Unpin for NetworkReceiver
impl Sync for NetworkReceiver
impl Send for NetworkReceiver
impl !RefUnwindSafe for NetworkReceiver
impl !UnwindSafe for NetworkReceiver
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,