pub struct TransformRegistry { /* private fields */ }Expand description
A registry for managing transform configurations.
This struct provides a way to register and manage multiple transform configurations that can be applied to images in sequence.
Implementations§
Source§impl TransformRegistry
impl TransformRegistry
Sourcepub fn new() -> TransformRegistry
pub fn new() -> TransformRegistry
Sourcepub fn add(&mut self, transform_type: TransformType, config: TransformConfig)
pub fn add(&mut self, transform_type: TransformType, config: TransformConfig)
Adds a transform to the registry.
§Arguments
transform_type- The type of transform to add.config- The configuration for the transform.
§Examples
use oar_ocr_core::core::config::transform::{TransformRegistry, TransformType, TransformConfig};
let mut registry = TransformRegistry::new();
registry.add(TransformType::ResizeImage, TransformConfig::ResizeImage {
width: Some(224),
height: Some(224),
shorter_side: None,
longer_side: None,
maintain_aspect_ratio: Some(false),
interpolation: None,
});
assert_eq!(registry.len(), 1);Sourcepub fn remove(&mut self, transform_type: &TransformType) -> usize
pub fn remove(&mut self, transform_type: &TransformType) -> usize
Sourcepub fn iter(&self) -> Iter<'_, (TransformType, TransformConfig)>
pub fn iter(&self) -> Iter<'_, (TransformType, TransformConfig)>
Gets an iterator over the transforms in the registry.
§Returns
An iterator over tuples of (TransformType, TransformConfig).
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, (TransformType, TransformConfig)>
pub fn iter_mut(&mut self) -> IterMut<'_, (TransformType, TransformConfig)>
Gets a mutable iterator over the transforms in the registry.
§Returns
A mutable iterator over tuples of (TransformType, TransformConfig).
Sourcepub fn contains(&self, transform_type: &TransformType) -> bool
pub fn contains(&self, transform_type: &TransformType) -> bool
Sourcepub fn get_all(&self, transform_type: &TransformType) -> Vec<&TransformConfig>
pub fn get_all(&self, transform_type: &TransformType) -> Vec<&TransformConfig>
Sourcepub fn get_first(
&self,
transform_type: &TransformType,
) -> Option<&TransformConfig>
pub fn get_first( &self, transform_type: &TransformType, ) -> Option<&TransformConfig>
Trait Implementations§
Source§impl Debug for TransformRegistry
impl Debug for TransformRegistry
Source§impl Default for TransformRegistry
impl Default for TransformRegistry
Source§fn default() -> TransformRegistry
fn default() -> TransformRegistry
This allows TransformRegistry to be created with default values.
Source§impl<'a> IntoIterator for &'a TransformRegistry
impl<'a> IntoIterator for &'a TransformRegistry
Source§fn into_iter(self) -> <&'a TransformRegistry as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a TransformRegistry as IntoIterator>::IntoIter
This allows &TransformRegistry to be used in for loops and other iterator contexts.
Source§type Item = &'a (TransformType, TransformConfig)
type Item = &'a (TransformType, TransformConfig)
Source§type IntoIter = Iter<'a, (TransformType, TransformConfig)>
type IntoIter = Iter<'a, (TransformType, TransformConfig)>
Source§impl<'a> IntoIterator for &'a mut TransformRegistry
impl<'a> IntoIterator for &'a mut TransformRegistry
Source§fn into_iter(self) -> <&'a mut TransformRegistry as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a mut TransformRegistry as IntoIterator>::IntoIter
This allows &mut TransformRegistry to be used in for loops and other iterator contexts.
Source§type Item = &'a mut (TransformType, TransformConfig)
type Item = &'a mut (TransformType, TransformConfig)
Source§type IntoIter = IterMut<'a, (TransformType, TransformConfig)>
type IntoIter = IterMut<'a, (TransformType, TransformConfig)>
Source§impl IntoIterator for TransformRegistry
impl IntoIterator for TransformRegistry
Source§fn into_iter(self) -> <TransformRegistry as IntoIterator>::IntoIter
fn into_iter(self) -> <TransformRegistry as IntoIterator>::IntoIter
This allows TransformRegistry to be used in for loops and other iterator contexts.
Source§type Item = (TransformType, TransformConfig)
type Item = (TransformType, TransformConfig)
Source§type IntoIter = IntoIter<<TransformRegistry as IntoIterator>::Item>
type IntoIter = IntoIter<<TransformRegistry as IntoIterator>::Item>
Auto Trait Implementations§
impl Freeze for TransformRegistry
impl RefUnwindSafe for TransformRegistry
impl Send for TransformRegistry
impl Sync for TransformRegistry
impl Unpin for TransformRegistry
impl UnwindSafe for TransformRegistry
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
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>
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>
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>
ReadEndian::read_from_little_endian().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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.