tremor_value::value::static

Struct StaticValue

source
pub struct StaticValue(/* private fields */);
Expand description

avoiding lifetime issues with generics See: https://github.com/rust-lang/rust/issues/64552

Implementations§

source§

impl StaticValue

source

pub fn into_value(self) -> Value<'static>

extract the inner Value

source

pub fn value(&self) -> &Value<'static>

get a reference to the inner value

Methods from Deref<Target = Value<'static>>§

source

pub fn clone_static(&self) -> Value<'static>

Clones the current value and enforces a static lifetime, it works the same as into_static but includes cloning logic

source

pub fn as_bytes(&self) -> Option<&[u8]>

Tries to get the bytes from a Value

source

pub fn try_as_bytes(&self) -> Result<&[u8], TryTypeError>

Tries to get the bytes from a Value

§Errors

if the value is not a byte array or string

source

pub fn get_bytes<Q>(&self, k: &Q) -> Option<&[u8]>
where Cow<'value, str>: Borrow<Q> + Hash + Eq, Q: Hash + Eq + Ord + ?Sized,

Tries to get an element of an object as bytes

source

pub fn as_char(&self) -> Option<char>

Tries to get the value as a char

source

pub fn is_char(&self) -> bool

Tests if the value can be represented as a char

source

pub fn get_char<Q>(&self, k: &Q) -> Option<char>
where Cow<'value, str>: Borrow<Q> + Hash + Eq, Q: Hash + Eq + Ord + ?Sized,

Tries to get an element of an object as char, takes the first one if it is a string

Trait Implementations§

source§

impl AsRef<Value<'static>> for StaticValue

source§

fn as_ref(&self) -> &Value<'static>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for StaticValue

source§

fn clone(&self) -> StaticValue

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 StaticValue

source§

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

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

impl Deref for StaticValue

source§

type Target = Value<'static>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'de> Deserialize<'de> for StaticValue

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for StaticValue

source§

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

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

impl From<Value<'static>> for StaticValue

source§

fn from(value: Value<'static>) -> Self

Converts to this type from the input type.
source§

impl PartialEq for StaticValue

source§

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

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

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

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

impl Serialize for StaticValue

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for StaticValue

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
source§

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

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

source§

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

source§

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>,

source§

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>,

source§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,