#[non_exhaustive]pub struct WorldParams {
pub world: WorldBlock,
pub cell_classes: Vec<CellClass>,
pub link_classes: Vec<LinkClass>,
}Expand description
The world params message (id 4): world block, cell classes and link classes.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.world: WorldBlockThe world block.
cell_classes: Vec<CellClass>The cell classes, at most 64.
link_classes: Vec<LinkClass>The link classes, at most 256.
Implementations§
Source§impl WorldParams
impl WorldParams
Sourcepub fn parse_message(payload: &[u8]) -> Result<Self>
pub fn parse_message(payload: &[u8]) -> Result<Self>
Parses a world params payload that starts with the protocol version.
§Errors
Fails when the payload is shorter than 4 bytes (“world params truncated”), when the version is
not PROTOCOL_VERSION (“server protocol version V, expected 10”), and for every error of
WorldParams::parse.
Sourcepub fn parse(payload: &[u8]) -> Result<Self>
pub fn parse(payload: &[u8]) -> Result<Self>
Parses a world params payload without the protocol version.
§Errors
Fails with the texts of spec 12.1: “message truncated”, “unexpected bytes after world params”, “implausible cell class count N”, “implausible link count N”, “invalid tile grid”, “invalid tile size”, “invalid cell class” and “implausible cell count” (more than 2048 cells).
Trait Implementations§
Source§impl Clone for WorldParams
impl Clone for WorldParams
Source§fn clone(&self) -> WorldParams
fn clone(&self) -> WorldParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WorldParams
impl Debug for WorldParams
Source§impl Default for WorldParams
impl Default for WorldParams
Source§fn default() -> WorldParams
fn default() -> WorldParams
Source§impl PartialEq for WorldParams
impl PartialEq for WorldParams
impl StructuralPartialEq for WorldParams
Auto Trait Implementations§
impl Freeze for WorldParams
impl RefUnwindSafe for WorldParams
impl Send for WorldParams
impl Sync for WorldParams
impl Unpin for WorldParams
impl UnsafeUnpin for WorldParams
impl UnwindSafe for WorldParams
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().