pub struct MapExternalProvider { /* private fields */ }Expand description
An ExternalConditionProvider backed by a HashMap<String, bool>.
Returns True/False for keys present in the map and Unknown for
missing keys. This is the simplest way for API callers to supply
external condition values.
§Example
use std::collections::HashMap;
use automapper_validation::{MapExternalProvider, ConditionResult};
use automapper_validation::eval::ExternalConditionProvider;
let mut conditions = HashMap::new();
conditions.insert("DateKnown".to_string(), true);
let provider = MapExternalProvider::new(conditions);
assert_eq!(provider.evaluate("DateKnown"), ConditionResult::True);
assert_eq!(provider.evaluate("Unknown"), ConditionResult::Unknown);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MapExternalProvider
impl RefUnwindSafe for MapExternalProvider
impl Send for MapExternalProvider
impl Sync for MapExternalProvider
impl Unpin for MapExternalProvider
impl UnsafeUnpin for MapExternalProvider
impl UnwindSafe for MapExternalProvider
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