[−][src]Struct conrod_core::image::Map
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, image::open("rust-logo.png")?), (CAT_PIC, 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]
pub fn new() -> Self
[src]
Construct a new, empty image::Map
.
pub fn get_mut(&mut self, id: Id) -> Option<&mut Img>
[src]
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.
pub fn insert(&mut self, img: Img) -> Id
[src]
Inserts the given image into the map, returning its associated image::Id
. The user must
store the returned image::Id
in order to use, modify or remove the inserted image.
Note: Calling this will trigger a redraw the next time Ui::draw_if_changed
is called.
pub fn replace(&mut self, id: Id, img: Img) -> Option<Img>
[src]
Replaces the given image in the map if it exists. Returns the image or None.
Note: Calling this will trigger a redraw the next time Ui::draw_if_changed
is called.
pub fn remove(&mut self, id: Id) -> Option<Img>
[src]
Removes the given image from the map if it exists. Returns the image or None.
Any future use of the given image::Id
will be invalid.
Note: Calling this will trigger a redraw the next time Ui::draw_if_changed
is called.
ⓘImportant traits for NewIdspub fn extend<I>(&mut self, images: I) -> NewIds where
I: IntoIterator<Item = Img>,
[src]
I: IntoIterator<Item = Img>,
Insert each of the images yielded by the given iterator and produce an iterator yielding
their generated Ids
in the same order.
Note: Calling this will trigger a redraw the next time Ui::draw_if_changed
is called.
Trait Implementations
Auto Trait Implementations
impl<Img> Send for Map<Img> where
Img: Send,
Img: Send,
impl<Img> Unpin for Map<Img> where
Img: Unpin,
Img: Unpin,
impl<Img> !Sync for Map<Img>
impl<Img> UnwindSafe for Map<Img> where
Img: RefUnwindSafe + UnwindSafe,
Img: RefUnwindSafe + UnwindSafe,
impl<Img> !RefUnwindSafe for Map<Img>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,