pub struct SessionImageManager { /* private fields */ }Expand description
Manages images within a session
Implementations§
Source§impl SessionImageManager
impl SessionImageManager
Sourcepub fn from_context(session_id: String, context: SessionImageContext) -> Self
pub fn from_context(session_id: String, context: SessionImageContext) -> Self
Create a session image manager from persisted context
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Get the session ID
Sourcepub fn add_image(
&mut self,
metadata: ImageMetadata,
analysis: Option<ImageAnalysisResult>,
) -> ImageResult<String>
pub fn add_image( &mut self, metadata: ImageMetadata, analysis: Option<ImageAnalysisResult>, ) -> ImageResult<String>
Sourcepub fn remove_image(&mut self, hash: &str) -> ImageResult<()>
pub fn remove_image(&mut self, hash: &str) -> ImageResult<()>
Remove an image from the session context
Note: The image is removed from current context but remains in history
Sourcepub fn get_image(&self, hash: &str) -> ImageResult<Option<MessageImageMetadata>>
pub fn get_image(&self, hash: &str) -> ImageResult<Option<MessageImageMetadata>>
Get an image from the session
Sourcepub fn get_current_images(&self) -> Vec<MessageImageMetadata>
pub fn get_current_images(&self) -> Vec<MessageImageMetadata>
Get all current images in the session
Sourcepub fn get_all_images(&self) -> Vec<MessageImageMetadata>
pub fn get_all_images(&self) -> Vec<MessageImageMetadata>
Get all images ever included in the session
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) -> ImageResult<()>
pub fn clear_current(&mut self) -> ImageResult<()>
Clear current images (but keep history)
Sourcepub fn clear_all(&mut self) -> ImageResult<()>
pub fn clear_all(&mut self) -> ImageResult<()>
Clear all images including history
Sourcepub fn get_context_for_persistence(&self) -> SessionImageContext
pub fn get_context_for_persistence(&self) -> SessionImageContext
Get the image context for persistence
Sourcepub fn restore_from_persistence(&mut self, context: SessionImageContext)
pub fn restore_from_persistence(&mut self, context: SessionImageContext)
Restore image context from persistence
Sourcepub fn get_current_image_hashes(&self) -> Vec<String>
pub fn get_current_image_hashes(&self) -> Vec<String>
Get image hashes in current context
Sourcepub fn get_all_image_hashes(&self) -> Vec<String>
pub fn get_all_image_hashes(&self) -> Vec<String>
Get all image hashes ever included
Sourcepub fn update_analysis(
&mut self,
hash: &str,
analysis: ImageAnalysisResult,
) -> ImageResult<()>
pub fn update_analysis( &mut self, hash: &str, analysis: ImageAnalysisResult, ) -> ImageResult<()>
Update analysis for an image
Sourcepub fn get_analysis(&self, hash: &str) -> Option<&ImageAnalysisResult>
pub fn get_analysis(&self, hash: &str) -> Option<&ImageAnalysisResult>
Get analysis for an image
Sourcepub fn get_all_analyses(&self) -> Vec<&ImageAnalysisResult>
pub fn get_all_analyses(&self) -> Vec<&ImageAnalysisResult>
Get all analyses
Trait Implementations§
Source§impl Clone for SessionImageManager
impl Clone for SessionImageManager
Source§fn clone(&self) -> SessionImageManager
fn clone(&self) -> SessionImageManager
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 moreAuto Trait Implementations§
impl Freeze for SessionImageManager
impl RefUnwindSafe for SessionImageManager
impl Send for SessionImageManager
impl Sync for SessionImageManager
impl Unpin for SessionImageManager
impl UnwindSafe for SessionImageManager
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 more