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,
}Trait Implementations§
impl<'map> Copy for Layer<'map>
impl<'map> StructuralPartialEq for Layer<'map>
Auto Trait Implementations§
impl<'map> Freeze for Layer<'map>
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