pub struct Contains { /* private fields */ }Expand description
The DynamoDB contains function. True if the attribute specified
by Path is one of the following:
- A
Stringthat contains a particular substring. - A
Setthat contains a particular element within the set. - A
Listthat contains a particular element within the list.
The operand must be a String if the attribute specified by path is a
String. If the attribute specified by path is a Set, the operand
must be the sets element type.
See also: Path::contains
use dynamodb_expression::{Num, Path};
// String
let condition = "foo".parse::<Path>()?.contains("Quinn");
assert_eq!(r#"contains(foo, "Quinn")"#, condition.to_string());
// Number
let condition = "foo".parse::<Path>()?.contains(Num::new(42));
assert_eq!(r#"contains(foo, 42)"#, condition.to_string());
// Binary
let condition = "foo".parse::<Path>()?.contains(Vec::<u8>::from("fish"));
assert_eq!(r#"contains(foo, "ZmlzaA==")"#, condition.to_string());Implementations§
Source§impl Contains
impl Contains
Sourcepub fn new<P, S>(path: P, operand: S) -> Self
pub fn new<P, S>(path: P, operand: S) -> Self
Allows for manually creating a Contains instance.
See also: Path::contains
use dynamodb_expression::{condition::Contains, Num, Path};
// String
let condition = Contains::new("foo".parse::<Path>()?, "Quinn");
assert_eq!(r#"contains(foo, "Quinn")"#, condition.to_string());
// Number
let condition = Contains::new("foo".parse::<Path>()?, Num::new(42));
assert_eq!(r#"contains(foo, 42)"#, condition.to_string());
// Binary
let condition = Contains::new("foo".parse::<Path>()?, Vec::<u8>::from("fish"));
assert_eq!(r#"contains(foo, "ZmlzaA==")"#, condition.to_string());Trait Implementations§
impl Eq for Contains
impl StructuralPartialEq for Contains
Auto Trait Implementations§
impl Freeze for Contains
impl RefUnwindSafe for Contains
impl Send for Contains
impl Sync for Contains
impl Unpin for Contains
impl UnwindSafe for Contains
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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 moreCreates a shared type from an unshared type.