[][src]Struct enet::Host

pub struct Host<T> { /* fields omitted */ }

A Host represents one endpoint of an ENet connection. Created through Enet.

This type provides functionality such as connection establishment and packet transmission.

Methods

impl<T> Host<T>[src]

pub fn flush(&mut self)[src]

Sends any queued packets on the host specified to its designated peers.

This function need only be used in circumstances where one wishes to send queued packets earlier than in a call to Host::service().

pub fn set_bandwith_limits(
    &mut self,
    incoming_bandwith: BandwidthLimit,
    outgoing_bandwidth: BandwidthLimit
)
[src]

Sets the bandwith limits for this Host.

pub fn set_channel_limit(&mut self, max_channel_count: ChannelLimit)[src]

Sets the maximum allowed channels of future connections.

pub fn channel_limit(&self) -> ChannelLimit[src]

Returns the limit of channels per connected peer for this Host.

pub fn incoming_bandwidth(&self) -> u32[src]

Returns the downstream bandwidth of this Host in bytes/second.

pub fn outgoing_bandwidth(&self) -> u32[src]

Returns the upstream bandwidth of this Host in bytes/second.

pub fn address(&self) -> Address[src]

Returns the internet address of this Host.

pub fn peer_count(&self) -> usize[src]

Returns the number of peers allocated for this Host.

pub fn peers(&mut self) -> impl Iterator<Item = Peer<T>>[src]

Returns an iterator over all peers connected to this Host.

pub fn service(&mut self, timeout_ms: u32) -> Result<Option<Event<T>>, Error>[src]

Maintains this host and delivers an event if available.

This should be called regularly for ENet to work properly with good performance.

pub fn check_events(&mut self) -> Result<Option<Event<T>>, Error>[src]

Checks for any queued events on this Host and dispatches one if available

pub fn connect(
    &mut self,
    address: &Address,
    channel_count: usize,
    user_data: u32
) -> Result<Peer<T>, Error>
[src]

Initiates a connection to a foreign host.

The connection will not be done until a Event::Connected for this peer was received.

channel_count specifies how many channels to allocate for this peer. user_data is a user-specified value that can be chosen arbitrarily.

Trait Implementations

impl<T> Drop for Host<T>[src]

fn drop(&mut self)[src]

Call the corresponding ENet cleanup-function(s).

Auto Trait Implementations

impl<T> !Send for Host<T>

impl<T> !Sync for Host<T>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]