pub fn update_with<'i>(&mut self, image: Option<&'i Image>) -> Option<&'i [u8]> {
        let new_value = image.map_or(CachedImageId::NoImage, |i| {
            if i.is_empty() {
                CachedImageId::NoImage
            } else {
                CachedImageId::Image(i.id())
            }
        });

        if *self != new_value {
            *self = new_value;
            Some(image.map_or(&[], |i| &i.data))
        } else {
            None
        }
    }
/// Updates the cached image ID based on the optional image provided to this
/// method. If a change is observed the image's data is returned. An empty
/// slice is returned when a transition to no image or no image data is
/// observed.
Updates the cached image ID based on the optional image provided to this
method. If a change is observed the image's data is returned. An empty
slice is returned when a transition to no image or no image data is
observed.
Updates the cached image ID based on the optional image provided to this method . If a change is observed the image ' s data is returned . An empty slice is returned when a transition to no image or no image data is observed .
pub fn update_with<'i>(&mut self, image: Option<&'i Image>) -> Option<&'i [u8]> {
        let new_value = image.map_or(CachedImageId::NoImage, |i| {
            if i.is_empty() {
                CachedImageId::NoImage
            } else {
                CachedImageId::Image(i.id())
            }
        });
        if *self != new_value {
            *self = new_value;
            Some(image.map_or(&[], |i| &i.data))
        } else {
            None
        }
    }
pub fn update_with < ' i > ( & mut self , image : Option < & ' i Image > ) -> Option < & ' i [ u8 ] > { let new_value = image . map_or ( CachedImageId :: NoImage , | i | { if i . is_empty ( ) { CachedImageId :: NoImage } else { CachedImageId :: Image ( i . id ( ) ) } } ) ; if * self != new_value { * self = new_value ; Some ( image . map_or ( & [ ] , | i | & i . data ) ) } else { None } }
Updates the cached image ID based on the optional image provided to this
method.
Updates the cached image ID based on the optional image provided to this method .
&mut self
image
Option<&'i Image>
&mut self
image
Option<&'i Image>