pub trait Layer: WritePacket {
type ExceptWriter<'a>: WritePacket
where Self: 'a;
type ViewWriter<'a>: WritePacket
where Self: 'a;
type ViewExceptWriter<'a>: WritePacket
where Self: 'a;
type RadiusWriter<'a>: WritePacket
where Self: 'a;
type RadiusExceptWriter<'a>: WritePacket
where Self: 'a;
// Required methods
fn except_writer(&mut self, except: Entity) -> Self::ExceptWriter<'_>;
fn view_writer(&mut self, pos: impl Into<ChunkPos>) -> Self::ViewWriter<'_>;
fn view_except_writer(
&mut self,
pos: impl Into<ChunkPos>,
except: Entity,
) -> Self::ViewExceptWriter<'_>;
fn radius_writer(
&mut self,
pos: impl Into<BlockPos>,
radius: u32,
) -> Self::RadiusWriter<'_>;
fn radius_except_writer(
&mut self,
pos: impl Into<BlockPos>,
radius: u32,
except: Entity,
) -> Self::RadiusExceptWriter<'_>;
}Expand description
Common functionality for layers. Notable implementors are ChunkLayer and
EntityLayer.
Layers support sending packets to viewers of the layer under various conditions. These are the “packet writers” exposed by this trait.
Layers themselves implement the WritePacket trait. Writing directly to a
layer will send packets to all viewers unconditionally.
Required Associated Types§
Sourcetype ExceptWriter<'a>: WritePacket
where
Self: 'a
type ExceptWriter<'a>: WritePacket where Self: 'a
Packet writer returned by except_writer.
Sourcetype ViewWriter<'a>: WritePacket
where
Self: 'a
type ViewWriter<'a>: WritePacket where Self: 'a
Packet writer returned by view_writer.
Sourcetype ViewExceptWriter<'a>: WritePacket
where
Self: 'a
type ViewExceptWriter<'a>: WritePacket where Self: 'a
Packet writer returned by
view_except_writer.
Sourcetype RadiusWriter<'a>: WritePacket
where
Self: 'a
type RadiusWriter<'a>: WritePacket where Self: 'a
Packet writer returned by radius_writer.
Sourcetype RadiusExceptWriter<'a>: WritePacket
where
Self: 'a
type RadiusExceptWriter<'a>: WritePacket where Self: 'a
Packet writer returned by
radius_except_writer.
Required Methods§
Sourcefn except_writer(&mut self, except: Entity) -> Self::ExceptWriter<'_>
fn except_writer(&mut self, except: Entity) -> Self::ExceptWriter<'_>
Returns a packet writer which sends packets to all viewers not
identified by except.
Sourcefn view_writer(&mut self, pos: impl Into<ChunkPos>) -> Self::ViewWriter<'_>
fn view_writer(&mut self, pos: impl Into<ChunkPos>) -> Self::ViewWriter<'_>
Returns a packet writer which sends packets to viewers in view of
the chunk position pos.
Sourcefn view_except_writer(
&mut self,
pos: impl Into<ChunkPos>,
except: Entity,
) -> Self::ViewExceptWriter<'_>
fn view_except_writer( &mut self, pos: impl Into<ChunkPos>, except: Entity, ) -> Self::ViewExceptWriter<'_>
Returns a packet writer which sends packets to viewers in
view of the chunk position pos and not identified by except.
Sourcefn radius_writer(
&mut self,
pos: impl Into<BlockPos>,
radius: u32,
) -> Self::RadiusWriter<'_>
fn radius_writer( &mut self, pos: impl Into<BlockPos>, radius: u32, ) -> Self::RadiusWriter<'_>
Returns a packet writer which sends packets to viewers within radius
blocks of the block position pos.
Sourcefn radius_except_writer(
&mut self,
pos: impl Into<BlockPos>,
radius: u32,
except: Entity,
) -> Self::RadiusExceptWriter<'_>
fn radius_except_writer( &mut self, pos: impl Into<BlockPos>, radius: u32, except: Entity, ) -> Self::RadiusExceptWriter<'_>
Returns a packet writer which sends packets to viewers within radius
blocks of the block position pos and not identified by except.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.