pub struct MapTypedPredicate<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike>(/* private fields */);Expand description
Represents a typed Predicate specifically for maps such as
std::collections::HashMap, ensuring that only valid conditions are
used for a given type.
This is required due to limitations in Rust’s blanket impl functionality, which will be resolved once specialization is available.
Implementations§
Source§impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> MapTypedPredicate<T, C>
impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> MapTypedPredicate<T, C>
Source§impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> MapTypedPredicate<T, C>
impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> MapTypedPredicate<T, C>
Sourcepub fn any<P: Into<TypedPredicate<T>>>(p: P) -> Self
pub fn any<P: Into<TypedPredicate<T>>>(p: P) -> Self
Creates a new typed predicate for Predicate::Any
§Examples
use entity::{TypedPredicate as P, MapTypedPredicate as MP};
use std::collections::HashMap;
let mut map = HashMap::new();
map.insert(String::from("a"), 1);
map.insert(String::from("b"), 2);
map.insert(String::from("c"), 3);
let p = MP::any(P::equals(3));
assert_eq!(p.check(map.clone()), true);
let p = MP::any(P::equals(4));
assert_eq!(p.check(map), false);Sourcepub fn contains(value: T) -> Self
pub fn contains(value: T) -> Self
Creates a new typed predicate for Predicate::Contains
§Examples
use entity::{TypedPredicate as P, MapTypedPredicate as MP};
use std::collections::HashMap;
let mut map = HashMap::new();
map.insert(String::from("a"), 1);
map.insert(String::from("b"), 2);
map.insert(String::from("c"), 3);
let p = MP::contains(3);
assert_eq!(p.check(map.clone()), true);
let p = MP::contains(4);
assert_eq!(p.check(map), false);Sourcepub fn contains_all<I: IntoIterator<Item = T>>(i: I) -> Self
pub fn contains_all<I: IntoIterator<Item = T>>(i: I) -> Self
Creates a new typed predicate for Predicate::ContainsAll
§Examples
use entity::{TypedPredicate as P, MapTypedPredicate as MP};
use std::collections::HashMap;
let mut map = HashMap::new();
map.insert(String::from("a"), 1);
map.insert(String::from("b"), 2);
map.insert(String::from("c"), 3);
let p = MP::contains_all(vec![1, 3]);
assert_eq!(p.check(map.clone()), true);
let p = MP::contains_all(vec![1, 4]);
assert_eq!(p.check(map), false);Sourcepub fn contains_any<I: IntoIterator<Item = T>>(i: I) -> Self
pub fn contains_any<I: IntoIterator<Item = T>>(i: I) -> Self
Creates a new typed predicate for Predicate::ContainsAny
§Examples
use entity::{TypedPredicate as P, MapTypedPredicate as MP};
use std::collections::HashMap;
let mut map = HashMap::new();
map.insert(String::from("a"), 1);
map.insert(String::from("b"), 2);
map.insert(String::from("c"), 3);
let p = MP::contains_any(vec![1, 4]);
assert_eq!(p.check(map.clone()), true);
let p = MP::contains_any(vec![4, 5]);
assert_eq!(p.check(map), false);Trait Implementations§
Source§impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> BitAnd for MapTypedPredicate<T, C>
impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> BitAnd for MapTypedPredicate<T, C>
Source§fn bitand(self, rhs: Self) -> Self
fn bitand(self, rhs: Self) -> Self
Shorthand to produce Predicate::And
Source§type Output = MapTypedPredicate<T, C>
type Output = MapTypedPredicate<T, C>
The resulting type after applying the
& operator.Source§impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> BitOr for MapTypedPredicate<T, C>
impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> BitOr for MapTypedPredicate<T, C>
Source§fn bitor(self, rhs: Self) -> Self
fn bitor(self, rhs: Self) -> Self
Shorthand to produce Predicate::Or
Source§type Output = MapTypedPredicate<T, C>
type Output = MapTypedPredicate<T, C>
The resulting type after applying the
| operator.Source§impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> BitXor for MapTypedPredicate<T, C>
impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> BitXor for MapTypedPredicate<T, C>
Source§fn bitxor(self, rhs: Self) -> Self
fn bitxor(self, rhs: Self) -> Self
Shorthand to produce Predicate::Xor
Source§type Output = MapTypedPredicate<T, C>
type Output = MapTypedPredicate<T, C>
The resulting type after applying the
^ operator.Source§impl<T: Clone + ValueLike, C: Clone + IntoIterator<Item = (String, T)> + ValueLike> Clone for MapTypedPredicate<T, C>
impl<T: Clone + ValueLike, C: Clone + IntoIterator<Item = (String, T)> + ValueLike> Clone for MapTypedPredicate<T, C>
Source§fn clone(&self) -> MapTypedPredicate<T, C>
fn clone(&self) -> MapTypedPredicate<T, C>
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<T: Debug + ValueLike, C: Debug + IntoIterator<Item = (String, T)> + ValueLike> Debug for MapTypedPredicate<T, C>
impl<T: Debug + ValueLike, C: Debug + IntoIterator<Item = (String, T)> + ValueLike> Debug for MapTypedPredicate<T, C>
Source§impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> From<MapTypedPredicate<T, C>> for Predicate
impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> From<MapTypedPredicate<T, C>> for Predicate
Source§fn from(map_typed_predicate: MapTypedPredicate<T, C>) -> Self
fn from(map_typed_predicate: MapTypedPredicate<T, C>) -> Self
Converts to this type from the input type.
Source§impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> From<MapTypedPredicate<T, C>> for TypedPredicate<C>
impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> From<MapTypedPredicate<T, C>> for TypedPredicate<C>
Source§fn from(map_typed_predicate: MapTypedPredicate<T, C>) -> Self
fn from(map_typed_predicate: MapTypedPredicate<T, C>) -> Self
Converts to this type from the input type.
Source§impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> From<Predicate> for MapTypedPredicate<T, C>
impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> From<Predicate> for MapTypedPredicate<T, C>
Source§impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> From<TypedPredicate<C>> for MapTypedPredicate<T, C>
impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> From<TypedPredicate<C>> for MapTypedPredicate<T, C>
Source§fn from(typed_predicate: TypedPredicate<C>) -> Self
fn from(typed_predicate: TypedPredicate<C>) -> Self
Converts to this type from the input type.
Source§impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> Not for MapTypedPredicate<T, C>
impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> Not for MapTypedPredicate<T, C>
Source§fn not(self) -> Self::Output
fn not(self) -> Self::Output
Shorthand to produce Predicate::Not
Source§type Output = MapTypedPredicate<T, C>
type Output = MapTypedPredicate<T, C>
The resulting type after applying the
! operator.Source§impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> PartialEq<Predicate> for MapTypedPredicate<T, C>
impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> PartialEq<Predicate> for MapTypedPredicate<T, C>
Source§impl<T: PartialEq + ValueLike, C: PartialEq + IntoIterator<Item = (String, T)> + ValueLike> PartialEq for MapTypedPredicate<T, C>
impl<T: PartialEq + ValueLike, C: PartialEq + IntoIterator<Item = (String, T)> + ValueLike> PartialEq for MapTypedPredicate<T, C>
impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> StructuralPartialEq for MapTypedPredicate<T, C>
Auto Trait Implementations§
impl<T, C> Freeze for MapTypedPredicate<T, C>
impl<T, C> !RefUnwindSafe for MapTypedPredicate<T, C>
impl<T, C> !Send for MapTypedPredicate<T, C>
impl<T, C> !Sync for MapTypedPredicate<T, C>
impl<T, C> Unpin for MapTypedPredicate<T, C>
impl<T, C> !UnwindSafe for MapTypedPredicate<T, C>
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