Enum dynamodb_expression::value::StringOrRef
source · 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(Path::new_name("foo"), "T");
assert_eq!(r#"begins_with(foo, "T")"#, begins_with.to_string());
let begins_with = BeginsWith::new(Path::new_name("foo"), 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 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
§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.