pub struct ValueRef<T: 'static = Value>(/* private fields */);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<Value>
impl ValueRef<Value>
pub fn new(value: Value) -> Self
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<Self, D::Error>where
D: Deserializer<'de>,
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 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 moreimpl<T: Eq + 'static> Eq for ValueRef<T>
impl<T: 'static> StructuralPartialEq for ValueRef<T>
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.