#[repr(u8)]pub enum Netplayer {
Player(u8),
Observer(u8),
Undecided(u8),
Unknown,
}Expand description
The position where a player is in a room slot.
In C++, Netplayer is a single enum value reused in many places. The Rust version
splits it into several distinct types that are no longer guaranteed to be equal. This
Netplayer is a compromise for the ygopro crate, adding the Undecided category and
the observer’s index. In particular, Observer(255) means the observer’s slot is
unknown.
These added parts are dropped when serializing: Observer always becomes 255, to
match the original data protocol. So (de)serialization of this type loses information
and must be handled carefully, especially when using Complex.
See also: CorePlayer,
ChatSource.
Variants§
Trait Implementations§
Source§impl BinRead for Netplayer
impl BinRead for Netplayer
Source§fn read_options<R: Read + Seek>(
__binrw_generated_var_reader: &mut R,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<Self>
fn read_options<R: Read + Seek>( __binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<Self>
Source§fn read<R>(reader: &mut R) -> Result<Self, Error>
fn read<R>(reader: &mut R) -> Result<Self, Error>
Read
Self from the reader using default arguments. Read moreSource§fn read_be<R>(reader: &mut R) -> Result<Self, Error>
fn read_be<R>(reader: &mut R) -> Result<Self, Error>
Read
Self from the reader using default arguments and assuming
big-endian byte order. Read moreSource§fn read_le<R>(reader: &mut R) -> Result<Self, Error>
fn read_le<R>(reader: &mut R) -> Result<Self, Error>
Read
Self from the reader using default arguments and assuming
little-endian byte order. Read moreSource§fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
Read
T from the reader assuming native-endian byte order. Read moreSource§fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Read
Self from the reader using the given arguments. Read moreSource§fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Read
Self from the reader, assuming big-endian byte order, using the
given arguments. Read moreSource§impl BinWrite for Netplayer
impl BinWrite for Netplayer
Source§fn write_options<W: Write + Seek>(
&self,
__binrw_generated_var_writer: &mut W,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<()>
fn write_options<W: Write + Seek>( &self, __binrw_generated_var_writer: &mut W, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<()>
Source§fn write<W>(&self, writer: &mut W) -> Result<(), Error>
fn write<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self to the writer using default arguments. Read moreSource§fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self to the writer assuming big-endian byte order. Read moreSource§fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self to the writer assuming little-endian byte order. Read moreSource§fn write_args<W>(
&self,
writer: &mut W,
args: Self::Args<'_>,
) -> Result<(), Error>
fn write_args<W>( &self, writer: &mut W, args: Self::Args<'_>, ) -> Result<(), Error>
Write
Self to the writer using the given arguments. Read moreimpl Copy for Netplayer
impl Eq for Netplayer
Source§impl From<CorePlayer> for Netplayer
impl From<CorePlayer> for Netplayer
Source§fn from(player: CorePlayer) -> Self
fn from(player: CorePlayer) -> Self
Converts to this type from the input type.
Source§impl From<Netplayer> for ChatSource
impl From<Netplayer> for ChatSource
Source§impl From<Netplayer> for CorePlayer
impl From<Netplayer> for CorePlayer
Source§impl FromPrimitive for Netplayer
impl FromPrimitive for Netplayer
Source§impl Ord for Netplayer
impl Ord for Netplayer
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Netplayer
impl PartialOrd for Netplayer
Source§impl ReadEndian for Netplayer
impl ReadEndian for Netplayer
Source§const ENDIAN: EndianKind = binrw::meta::EndianKind::None
const ENDIAN: EndianKind = binrw::meta::EndianKind::None
The endianness of the type.
Source§impl Specifier for Netplayer
impl Specifier for Netplayer
Source§type Bytes = u8
type Bytes = u8
The storage type. This is typically the smallest integer primitive that
can store all possible values of the
InOut type.Source§type InOut = Netplayer
type InOut = Netplayer
The interface type. This type is used by getters and setters. For
integers, this is the same as the
Bytes type; for other
types with more logical representations, like an enum or struct, this is
the enum or struct.Source§fn into_bytes(input: Self) -> Result<Self::Bytes, OutOfBounds>
fn into_bytes(input: Self) -> Result<Self::Bytes, OutOfBounds>
Converts an interface type into its storage type. Read more
Source§fn from_bytes(
bytes: Self::Bytes,
) -> Result<Self, InvalidBitPattern<Self::Bytes>>
fn from_bytes( bytes: Self::Bytes, ) -> Result<Self, InvalidBitPattern<Self::Bytes>>
Converts a storage type into its interface type. Read more
impl StructuralPartialEq for Netplayer
Source§impl TryFrom<ChatSource> for Netplayer
impl TryFrom<ChatSource> for Netplayer
Source§impl WriteEndian for Netplayer
impl WriteEndian for Netplayer
Source§const ENDIAN: EndianKind = binrw::meta::EndianKind::None
const ENDIAN: EndianKind = binrw::meta::EndianKind::None
The endianness of the type.
Auto Trait Implementations§
impl Freeze for Netplayer
impl RefUnwindSafe for Netplayer
impl Send for Netplayer
impl Sync for Netplayer
impl Unpin for Netplayer
impl UnsafeUnpin for Netplayer
impl UnwindSafe for Netplayer
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
Mutably borrows from an owned value. Read more