pub struct MemorySocketServer { /* private fields */ }Expand description
Implementation of ServerSocket for a server socket using in-memory channels.
In-memory sockets are treated as encrypted and reliable by default for efficiency. Use Self::new_with to use
a different policy (this is useful for performance tests).
Implementations§
Source§impl MemorySocketServer
impl MemorySocketServer
Sourcepub fn new(clients: Vec<(u16, MemorySocketChannels)>) -> Self
pub fn new(clients: Vec<(u16, MemorySocketChannels)>) -> Self
Makes a new in-memory socket for a server.
Takes a vector of (client id, socket channels).
Sourcepub fn new_with(
clients: Vec<(u16, MemorySocketChannels)>,
encrypted: bool,
reliable: bool,
) -> Self
pub fn new_with( clients: Vec<(u16, MemorySocketChannels)>, encrypted: bool, reliable: bool, ) -> Self
Makes a new in-memory socket for a server with a specific encryption policy.
Takes a vector of (client id, socket channels).
If encrypted is set to true then the memory transport will be treated as if it were encrypted.
If you want renet2 to encrypt the channel, set it to false.
If reliable is set to true then the memory transport will downgrade all channels to unreliable.
If you don’t want to downgrade channels (e.g. for performance testing), set it to false.
Trait Implementations§
Source§impl Debug for MemorySocketServer
impl Debug for MemorySocketServer
Source§impl ServerSocket for MemorySocketServer
impl ServerSocket for MemorySocketServer
Source§fn is_encrypted(&self) -> bool
fn is_encrypted(&self) -> bool
Source§fn is_reliable(&self) -> bool
fn is_reliable(&self) -> bool
Source§fn connection_denied(&mut self, _: SocketAddr)
fn connection_denied(&mut self, _: SocketAddr)
Source§fn connection_accepted(&mut self, _: u64, _: SocketAddr)
fn connection_accepted(&mut self, _: u64, _: SocketAddr)
Source§fn disconnect(&mut self, _: SocketAddr)
fn disconnect(&mut self, _: SocketAddr)
Source§fn preupdate(&mut self)
fn preupdate(&mut self)
Source§fn try_recv(&mut self, buffer: &mut [u8]) -> Result<(usize, SocketAddr)>
fn try_recv(&mut self, buffer: &mut [u8]) -> Result<(usize, SocketAddr)>
Source§fn postupdate(&mut self)
fn postupdate(&mut self)
Source§fn send(
&mut self,
addr: SocketAddr,
packet: &[u8],
) -> Result<(), NetcodeTransportError>
fn send( &mut self, addr: SocketAddr, packet: &[u8], ) -> Result<(), NetcodeTransportError>
Auto Trait Implementations§
impl Freeze for MemorySocketServer
impl RefUnwindSafe for MemorySocketServer
impl Send for MemorySocketServer
impl Sync for MemorySocketServer
impl Unpin for MemorySocketServer
impl UnwindSafe for MemorySocketServer
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.