Struct dynamodb_expression::condition::Contains
source · 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§
source§impl PartialEq for Contains
impl PartialEq for Contains
impl Eq for Contains
impl StructuralEq for Contains
impl StructuralPartialEq for Contains
Auto Trait Implementations§
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Creates a shared type from an unshared type.