pub enum PlayerConnection {
Java(JavaConnection),
Other(Box<dyn NetworkConnection>),
}Expand description
Concrete player connection type using enum_dispatch for zero-cost dispatch.
The Java variant handles real Java connections while Other supports tests
and alternative backends.
Variants§
Java(JavaConnection)
A real Java client connection.
Other(Box<dyn NetworkConnection>)
A dynamic connection for tests or other backends.
Trait Implementations§
Source§impl From<Box<dyn NetworkConnection>> for PlayerConnection
impl From<Box<dyn NetworkConnection>> for PlayerConnection
Source§fn from(v: Box<dyn NetworkConnection>) -> PlayerConnection
fn from(v: Box<dyn NetworkConnection>) -> PlayerConnection
Source§impl From<JavaConnection> for PlayerConnection
impl From<JavaConnection> for PlayerConnection
Source§fn from(v: JavaConnection) -> PlayerConnection
fn from(v: JavaConnection) -> PlayerConnection
Source§impl NetworkConnection for PlayerConnection
impl NetworkConnection for PlayerConnection
Source§fn compression(&self) -> Option<CompressionInfo>
fn compression(&self) -> Option<CompressionInfo>
Returns compression info for packet encoding.
Returns None if compression is disabled (e.g., for test connections).
Source§fn send_encoded(&self, __enum_dispatch_arg_0: EncodedPacket)
fn send_encoded(&self, __enum_dispatch_arg_0: EncodedPacket)
Sends a pre-encoded packet.
This is the object-safe method that accepts already-encoded packets.
Use Player::send_packet() for the generic version that handles encoding.
Source§fn send_encoded_bundle(&self, __enum_dispatch_arg_0: Vec<EncodedPacket>)
fn send_encoded_bundle(&self, __enum_dispatch_arg_0: Vec<EncodedPacket>)
Sends multiple pre-encoded packets as an atomic bundle.
The implementation wraps the packets with bundle delimiter packets so
the client processes them together in a single game tick.
Use Player::send_bundle() for the generic version that handles encoding.
Source§fn disconnect_with_reason(&self, __enum_dispatch_arg_0: TextComponent)
fn disconnect_with_reason(&self, __enum_dispatch_arg_0: TextComponent)
Disconnects the player with a reason.
Source§impl TryInto<Box<dyn NetworkConnection>> for PlayerConnection
impl TryInto<Box<dyn NetworkConnection>> for PlayerConnection
Source§impl TryInto<JavaConnection> for PlayerConnection
impl TryInto<JavaConnection> for PlayerConnection
Auto Trait Implementations§
impl !Freeze for PlayerConnection
impl !RefUnwindSafe for PlayerConnection
impl !UnwindSafe for PlayerConnection
impl Send for PlayerConnection
impl Sync for PlayerConnection
impl Unpin for PlayerConnection
impl UnsafeUnpin for PlayerConnection
Blanket Implementations§
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreArc<SyncMutex<>>