Struct conrod::image::Map
[−]
[src]
pub struct Map<Img> { pub trigger_redraw: Cell<bool>, // some fields omitted }
A type used to map the widget::Id
of Image
widgets to their associated Img
data.
The image::Map
type is usually instantiated and loaded during the "setup" stage of the
application before the main loop begins. A macro is provided to simplify the construction of
maps with multiple images.
let image_map = image_map! { (RUST_LOGO, try!(image::open("rust-logo.png"))), (CAT_PIC, try!(image::open("floof.jpeg"))), };
Fields
trigger_redraw: Cell<bool>
Whether or not the image::Map
will trigger a redraw the next time Ui::draw
is called.
This is automatically set to true
when any method that takes &mut self
is called.
Methods
impl<Img> Map<Img>
[src]
fn new() -> Self
Construct a new, empty image::Map
.
fn get_mut(&mut self, id: Id) -> Option<&mut Img>
Uniquely borrow the Img
associated with the given widget.
Note: Calling this will trigger a redraw the next time Ui::draw_if_changed
is called.
fn insert(&mut self, id: Id, img: Img) -> Option<Img>
Inserts the given widget-image pair into the map.
If the map did not already have an image associated with this widget, None
is returned.
If the map did already have an image associated with this widget, the old value is removed from the map and returned.
Note: Calling this will trigger a redraw the next time Ui::draw_if_changed
is called.
Trait Implementations
impl<Img> Deref for Map<Img>
[src]
type Target = HashMap<Img>
The resulting type after dereferencing
fn deref(&self) -> &Self::Target
The method called to dereference a value