pub struct Layer<'map> { /* private fields */ }
Expand description
A generic map layer, accessed via Map::layers()
.
Implementations§
source§impl<'map> Layer<'map>
impl<'map> Layer<'map>
sourcepub fn layer_type(&self) -> LayerType<'map>
pub fn layer_type(&self) -> LayerType<'map>
Get the layer’s type.
sourcepub fn as_tile_layer(self) -> Option<TileLayer<'map>>
pub fn as_tile_layer(self) -> Option<TileLayer<'map>>
Convenience method to return this layer as a tile layer, only if it is one.
Identical to:
ⓘ
match layer.layer_type() {
LayerType::Tiles(x) => Some(x),
_ => None,
}
sourcepub fn as_object_layer(self) -> Option<ObjectLayer<'map>>
pub fn as_object_layer(self) -> Option<ObjectLayer<'map>>
Convenience method to return this layer as an object group, only if it is one.
Identical to:
ⓘ
match layer.layer_type() {
LayerType::Objects(x) => Some(x),
_ => None,
}
sourcepub fn as_image_layer(self) -> Option<ImageLayer<'map>>
pub fn as_image_layer(self) -> Option<ImageLayer<'map>>
Convenience method to return this layer as an image layer, only if it is one.
Identical to:
ⓘ
match layer.layer_type() {
LayerType::Image(x) => Some(x),
_ => None,
}
sourcepub fn as_group_layer(self) -> Option<GroupLayer<'map>>
pub fn as_group_layer(self) -> Option<GroupLayer<'map>>
Convenience method to return this layer as a group layer, only if it is one.
Identical to:
ⓘ
match layer.layer_type() {
LayerType::Group(x) => Some(x),
_ => None,
}
Methods from Deref<Target = LayerData>§
Trait Implementations§
source§impl<'map> PartialEq for Layer<'map>
impl<'map> PartialEq for Layer<'map>
impl<'map> Copy for Layer<'map>
impl<'map> StructuralPartialEq for Layer<'map>
Auto Trait Implementations§
impl<'map> RefUnwindSafe for Layer<'map>
impl<'map> Send for Layer<'map>
impl<'map> Sync for Layer<'map>
impl<'map> Unpin for Layer<'map>
impl<'map> UnwindSafe for Layer<'map>
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