pub struct SessionImageContext {
pub current_images: Vec<String>,
pub all_images: Vec<String>,
pub image_metadata: HashMap<String, ImageMetadata>,
}Expand description
Session context for images
Fields§
§current_images: Vec<String>Images currently in the session context (by hash)
all_images: Vec<String>All images ever included in this session (by hash)
image_metadata: HashMap<String, ImageMetadata>Map of image hash to metadata for quick lookup
Implementations§
Source§impl SessionImageContext
impl SessionImageContext
Sourcepub fn add_image(&mut self, hash: String, metadata: ImageMetadata)
pub fn add_image(&mut self, hash: String, metadata: ImageMetadata)
Add an image to the current session context
§Arguments
hash- The image hashmetadata- The image metadata
Sourcepub fn remove_image(&mut self, hash: &str)
pub fn remove_image(&mut self, hash: &str)
Remove an image from the current session context
Note: The image is removed from current context but remains in all_images
Sourcepub fn get_current_images(&self) -> Vec<&ImageMetadata>
pub fn get_current_images(&self) -> Vec<&ImageMetadata>
Get the current images in the session
Sourcepub fn get_all_images(&self) -> Vec<&ImageMetadata>
pub fn get_all_images(&self) -> Vec<&ImageMetadata>
Get all images ever included in the session
Sourcepub fn get_image_metadata(&self, hash: &str) -> Option<&ImageMetadata>
pub fn get_image_metadata(&self, hash: &str) -> Option<&ImageMetadata>
Get image metadata by hash
Sourcepub fn current_image_count(&self) -> usize
pub fn current_image_count(&self) -> usize
Get the number of current images
Sourcepub fn total_image_count(&self) -> usize
pub fn total_image_count(&self) -> usize
Get the total number of images ever included
Sourcepub fn clear_current(&mut self)
pub fn clear_current(&mut self)
Clear current images (but keep history)
Trait Implementations§
Source§impl Clone for SessionImageContext
impl Clone for SessionImageContext
Source§fn clone(&self) -> SessionImageContext
fn clone(&self) -> SessionImageContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionImageContext
impl Debug for SessionImageContext
Source§impl Default for SessionImageContext
impl Default for SessionImageContext
Source§fn default() -> SessionImageContext
fn default() -> SessionImageContext
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SessionImageContext
impl<'de> Deserialize<'de> for SessionImageContext
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SessionImageContext
impl RefUnwindSafe for SessionImageContext
impl Send for SessionImageContext
impl Sync for SessionImageContext
impl Unpin for SessionImageContext
impl UnwindSafe for SessionImageContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().