pub struct Value(/* private fields */);Expand description
Value is a transparent wrapper around a protobuf value. It adds helper methods for accessing the underlying value.
Implementations§
Source§impl Value
impl Value
Sourcepub fn try_as_string(&self) -> Option<&str>
pub fn try_as_string(&self) -> Option<&str>
Returns the underlying string value if the kind is String.
Sourcepub fn as_string(&self) -> &str
pub fn as_string(&self) -> &str
Returns the underlying string value. Panics if the kind is not String.
Sourcepub fn try_as_bool(&self) -> Option<bool>
pub fn try_as_bool(&self) -> Option<bool>
Returns the underlying bool value if the kind is Bool.
Sourcepub fn as_bool(&self) -> bool
pub fn as_bool(&self) -> bool
Returns the underlying bool value. Panics if the kind is not Bool.
Sourcepub fn try_as_f64(&self) -> Option<f64>
pub fn try_as_f64(&self) -> Option<f64>
Returns the underlying number value if the kind is Number.
Sourcepub fn as_f64(&self) -> f64
pub fn as_f64(&self) -> f64
Returns the underlying number value. Panics if the kind is not Number.
Sourcepub fn try_as_struct(&self) -> Option<&Struct>
pub fn try_as_struct(&self) -> Option<&Struct>
Returns the underlying struct value as a map of Values if the kind is Struct.
Sourcepub fn as_struct(&self) -> &Struct
pub fn as_struct(&self) -> &Struct
Returns the underlying struct value. Panics if the kind is not Struct.
Sourcepub fn try_as_list(&self) -> Option<&List>
pub fn try_as_list(&self) -> Option<&List>
Returns the underlying list value as a vector of Values if the kind is List.
Trait Implementations§
Source§impl FromValue for Value
impl FromValue for Value
Source§fn from_value(value: &Value, _type: &Type) -> Result<Self, ConvertError>
fn from_value(value: &Value, _type: &Type) -> Result<Self, ConvertError>
Converts a Spanner value into the target Rust type, using the provided
Spanner
Type metadata for compatibility checks. Read moreimpl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request