pub struct StageContext {
pub current_image: Arc<RgbImage>,
pub original_image: Arc<RgbImage>,
pub image_index: usize,
pub global_config: HashMap<String, Value>,
pub stage_results: HashMap<StageId, Box<dyn Any + Send + Sync>>,
}Expand description
Context information available to pipeline stages during execution.
Fields§
§current_image: Arc<RgbImage>Current image being processed
original_image: Arc<RgbImage>Original input image (before any transformations)
image_index: usizeIndex of the current image in batch processing
global_config: HashMap<String, Value>Global pipeline configuration
stage_results: HashMap<StageId, Box<dyn Any + Send + Sync>>Results from previous stages
Implementations§
Source§impl StageContext
impl StageContext
Sourcepub fn new(
current_image: Arc<RgbImage>,
original_image: Arc<RgbImage>,
image_index: usize,
) -> Self
pub fn new( current_image: Arc<RgbImage>, original_image: Arc<RgbImage>, image_index: usize, ) -> Self
Create a new stage context.
Sourcepub fn get_stage_result<T: 'static>(&self, stage_id: &StageId) -> Option<&T>
pub fn get_stage_result<T: 'static>(&self, stage_id: &StageId) -> Option<&T>
Get a result from a previous stage.
Sourcepub fn set_stage_result<T: 'static + Send + Sync>(
&mut self,
stage_id: StageId,
result: T,
)
pub fn set_stage_result<T: 'static + Send + Sync>( &mut self, stage_id: StageId, result: T, )
Set a result from a stage.
Sourcepub fn get_config<T>(&self, key: &str) -> Option<T>where
T: for<'de> Deserialize<'de>,
pub fn get_config<T>(&self, key: &str) -> Option<T>where
T: for<'de> Deserialize<'de>,
Get a global configuration value.
Sourcepub fn set_config<T>(&mut self, key: String, value: T)where
T: Serialize,
pub fn set_config<T>(&mut self, key: String, value: T)where
T: Serialize,
Set a global configuration value.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StageContext
impl !RefUnwindSafe for StageContext
impl Send for StageContext
impl Sync for StageContext
impl Unpin for StageContext
impl !UnwindSafe for StageContext
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> 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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.