pub struct ValueRef<T = Value>(/* private fields */)
where
T: 'static;Expand description
A literal value which may be passed to a component.
This is a reference to a value owned by an Arc<serde_json::Value>.
The value is projected to a subfield of the Arc when accessed.
This is useful for avoiding cloning the value when accessing nested fields.
The value is projected to a subfield of the Arc when accessed.
Implementations§
Source§impl ValueRef
impl ValueRef
pub fn new(value: Value) -> ValueRef
Sourcepub fn redacted<'a>(&'a self, secrets: &'a Secrets) -> RedactedValue<'a>
pub fn redacted<'a>(&'a self, secrets: &'a Secrets) -> RedactedValue<'a>
Return a redacted version of this value ref for printing.
pub fn is_truthy(&self) -> bool
Sourcepub fn resolve_json_path(&self, json_path: &JsonPath) -> Option<ValueRef>
pub fn resolve_json_path(&self, json_path: &JsonPath) -> Option<ValueRef>
Access value using a JSON path
Sourcepub fn as_object(&self) -> Option<ValueRef<Map<String, Value>>>
pub fn as_object(&self) -> Option<ValueRef<Map<String, Value>>>
Cast to an object if this value is an object
Sourcepub fn as_array(&self) -> Option<ValueRef<Vec<Value>>>
pub fn as_array(&self) -> Option<ValueRef<Vec<Value>>>
Cast to an array if this value is an array
pub fn value(&self) -> &Value
Sourcepub fn clone_value(&self) -> Value
pub fn clone_value(&self) -> Value
Clone the underlying JSON value
Sourcepub fn deserialize<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
pub fn deserialize<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
Deserialize the value into a specific type
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ValueRef
impl<'de> Deserialize<'de> for ValueRef
Source§fn deserialize<D>(
deserializer: D,
) -> Result<ValueRef, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ValueRef, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for ValueRef
impl JsonSchema for ValueRef
Source§fn json_schema(_generator: &mut SchemaGenerator) -> Schema
fn json_schema(_generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl Serialize for ValueRef
impl Serialize for ValueRef
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> Eq for ValueRef<T>where
T: Eq + 'static,
impl<T> StructuralPartialEq for ValueRef<T>where
T: 'static,
Auto Trait Implementations§
impl<T> Freeze for ValueRef<T>
impl<T> RefUnwindSafe for ValueRef<T>where
T: RefUnwindSafe,
impl<T> Send for ValueRef<T>where
T: Sync,
impl<T> Sync for ValueRef<T>where
T: Sync,
impl<T> Unpin for ValueRef<T>
impl<T> UnsafeUnpin for ValueRef<T>
impl<T> UnwindSafe for ValueRef<T>where
T: RefUnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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