[−][src]Struct enet::Host
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]
&mut self,
incoming_bandwith: BandwidthLimit,
outgoing_bandwidth: BandwidthLimit
)
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]
&mut self,
address: &Address,
channel_count: usize,
user_data: u32
) -> Result<Peer<T>, Error>
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
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,