pub enum StringOrRef {
String(String),
Ref(Ref),
}Expand description
Represents a value that is either a string, or a reference to a value already in the expression attribute values.
use dynamodb_expression::value::{StringOrRef, Ref};
let value: StringOrRef = "a string value".into();
let value: StringOrRef = Ref::new("expression_value").into();For example, the BeginsWith operator can take a string or a reference to
an extended attribute value. Here’s how StringOrRef works with that.
use dynamodb_expression::{condition::BeginsWith, value::Ref, Path};
let begins_with = BeginsWith::new("foo".parse::<Path>()?, "T");
assert_eq!(r#"begins_with(foo, "T")"#, begins_with.to_string());
let begins_with = BeginsWith::new("foo".parse::<Path>()?, Ref::new("prefix"));
assert_eq!(r#"begins_with(foo, :prefix)"#, begins_with.to_string());See also: Ref
Variants§
Trait Implementations§
Source§impl From<&&str> for StringOrRef
impl From<&&str> for StringOrRef
Source§impl From<&String> for StringOrRef
impl From<&String> for StringOrRef
Source§impl From<&str> for StringOrRef
impl From<&str> for StringOrRef
Source§impl From<Ref> for StringOrRef
impl From<Ref> for StringOrRef
Auto Trait Implementations§
impl Freeze for StringOrRef
impl RefUnwindSafe for StringOrRef
impl Send for StringOrRef
impl Sync for StringOrRef
impl Unpin for StringOrRef
impl UnwindSafe for StringOrRef
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> 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.