[−][src]Struct grubbnet::Server
Methods
impl Server
[src]
pub fn host(ip: &str, port: u16, connection_limit: usize) -> Result<Server>
[src]
Begin hosting a TCP server.
pub fn num_connections(&self) -> usize
[src]
Get the current number of connections.
pub fn connection_limit(&self) -> usize
[src]
Get the maximum number of connections allowed.
pub fn drain_incoming_packets(&mut self) -> Vec<(Token, Packet)>
[src]
Drain any incoming packets and return them.
pub fn kick(&mut self, connection_token: Token) -> Result<()>
[src]
Kick a connection from the server.
pub fn send(&mut self, recipient: PacketRecipient, packet: impl PacketBody)
[src]
Send a packet. This function will box the packet, then queue it to be sent on the next server tick.
pub fn send_boxed(
&mut self,
recipient: PacketRecipient,
packet_boxed: Box<dyn PacketBody>
)
[src]
&mut self,
recipient: PacketRecipient,
packet_boxed: Box<dyn PacketBody>
)
Send a boxed packet.
Similar to send
, but this is moreuseful when you have a boxed packet already and don't want
to cast it to a concrete type before sending it.
pub fn tick(&mut self) -> Vec<ServerEvent>
[src]
Runs a network tick, which sends/receives packets based on socket readiness, as well as accepts new connections.
Auto Trait Implementations
impl !RefUnwindSafe for Server
impl !Send for Server
impl !Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> 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>,