pub enum Scalar {
    String(String),
    Num(Num),
    Bool(bool),
    Binary(Vec<u8>),
    Null,
}
Expand description

Variants§

§

String(String)

DynamoDB string value

§

Num(Num)

DynamoDB numeric value

§

Bool(bool)

DynamoDB boolean value

§

Binary(Vec<u8>)

DynamoDB binary value

§

Null

DynamoDB null value

Implementations§

source§

impl Scalar

source

pub fn new_string<T>(value: T) -> Self
where T: Into<String>,

Use when you need a string value for DynamoDB.

See also: Value::new_string

source

pub fn new_num<N>(value: N) -> Self
where N: ToString + Num,

Use when you need a numeric value for DynamoDB.

See also: Scalar::new_num_lower_exp, Scalar::new_num_upper_exp, Value::new_num, Num

§Examples
use dynamodb_expression::Scalar;

let value = Scalar::new_num(2600);
assert_eq!("2600", value.to_string());

let value = Scalar::new_num(2600.0);
assert_eq!("2600", value.to_string());
source

pub fn new_num_lower_exp<N>(value: N) -> Self
where N: LowerExp + Num,

Use when you need a numeric value for DynamoDB in exponent form (with a lowercase e).

See also: Scalar::new_num, Scalar::new_num_upper_exp, Value::new_num_lower_exp, Num

§Examples
use dynamodb_expression::Scalar;

let value = Scalar::new_num_lower_exp(2600);
assert_eq!("2.6e3", value.to_string());

let value = Scalar::new_num_lower_exp(2600.0);
assert_eq!("2.6e3", value.to_string());
source

pub fn new_num_upper_exp<N>(value: N) -> Self
where N: UpperExp + Num,

Use when you need a numeric value for DynamoDB in exponent form (with an uppercase e).

See also: Scalar::new_num, Scalar::new_num_lower_exp, Value::new_num_upper_exp, Num

§Examples
use dynamodb_expression::Scalar;

let value = Scalar::new_num_upper_exp(2600);
assert_eq!("2.6E3", value.to_string());

let value = Scalar::new_num_upper_exp(2600.0);
assert_eq!("2.6E3", value.to_string());
source

pub fn new_bool(b: bool) -> Self

Use when you need a boolean value for DynamoDB.

See also: Value::new_bool

source

pub fn new_binary<B>(binary: B) -> Self
where B: Into<Vec<u8>>,

Use when you need a binary value for DynamoDB.

See also: Value::new_binary

source

pub fn new_null() -> Self

Use when you need a null value for DynamoDB.

See also: Value::new_null

Trait Implementations§

source§

impl Clone for Scalar

source§

fn clone(&self) -> Scalar

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Scalar

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Scalar

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&&str> for Scalar

source§

fn from(value: &&str) -> Self

Converts to this type from the input type.
source§

impl From<&[u8]> for Scalar

source§

fn from(value: &[u8]) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> From<&[u8; N]> for Scalar

source§

fn from(value: &[u8; N]) -> Self

Converts to this type from the input type.
source§

impl From<&String> for Scalar

source§

fn from(value: &String) -> Self

Converts to this type from the input type.
source§

impl From<&str> for Scalar

source§

fn from(value: &str) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> From<[u8; N]> for Scalar

source§

fn from(value: [u8; N]) -> Self

Converts to this type from the input type.
source§

impl From<()> for Scalar

source§

fn from(_: ()) -> Self

Converts to this type from the input type.
source§

impl From<Num> for Scalar

source§

fn from(value: Num) -> Self

Converts to this type from the input type.
source§

impl From<Scalar> for Value

source§

fn from(value: Scalar) -> Self

Converts to this type from the input type.
source§

impl From<String> for Scalar

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl From<Vec<u8>> for Scalar

source§

fn from(value: Vec<u8>) -> Self

Converts to this type from the input type.
source§

impl From<bool> for Scalar

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl FromIterator<u8> for Scalar

source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = u8>,

Creates a value from an iterator. Read more
source§

impl Hash for Scalar

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Scalar

source§

fn cmp(&self, other: &Scalar) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Scalar

source§

fn eq(&self, other: &Scalar) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Scalar

source§

fn partial_cmp(&self, other: &Scalar) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Eq for Scalar

source§

impl StructuralEq for Scalar

source§

impl StructuralPartialEq for Scalar

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

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
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more