pub struct MapData { /* private fields */ }Expand description
Geometry ready to draw, from MapBuilder::build or
MapData::from_bytes. Make it once and share it, e.g. in the App.
Implementations§
Source§impl MapData
impl MapData
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
The map as MapData::from_bytes reads it, little-endian: DFM2,
the bounds as four f32; a u32 count of layers and for each its color
as four f32 and a u32 of the level drawn in place of each, four bits
a level; a u32 count of tiles and for each its cell as four f32,
min_scale, a u32 of its layer and (high byte, 255 for labels) level
and a u32 length of its geometry; then each tile’s geometry as
[encode] writes it.
Sourcepub fn from_bytes(bytes: &'static [u8]) -> Option<MapData>
pub fn from_bytes(bytes: &'static [u8]) -> Option<MapData>
A map written by MapData::to_bytes, usually include_bytes!d.
Only the index is read here; each tile is decoded the first time
it’s drawn. None if bytes aren’t one or are truncated.
Auto Trait Implementations§
impl !RefUnwindSafe for MapData
impl !Send for MapData
impl !Sync for MapData
impl Forget for MapData
impl Freeze for MapData
impl Move for MapData
impl Unpin for MapData
impl UnsafeUnpin for MapData
impl UnwindSafe for MapData
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.