Skip to main content

Interpolated

Struct Interpolated 

Source
pub struct Interpolated { /* private fields */ }
Expand description

A document of var holes in otherwise literal data, $ keys kept verbatim. It is for payloads such as a MongoDB filter, where $oid is data and {"var": ...} is the only live part.

Any other operator-shaped node, val included, stays data and is reported as OPERATOR_IN_DOCUMENT; a secret node is refused as SECRET_IN_DOCUMENT. A hole’s default is data too, and is checked the same way.

Implementations§

Source§

impl Interpolated

Source

pub fn raw(&self) -> &Value

The document as authored, as a serde_json::Value, its objects’ keys in the order they were written: the crate turns on serde_json’s preserve_order.

Source

pub fn holes(&self) -> impl Iterator<Item = &Path>

The paths the holes read, in document order. A hole rooted at payload reads nothing and is not listed.

Trait Implementations§

Source§

impl ConfigField for Interpolated

Source§

const NULL_IS_VALUE: bool = true

null is a document with no hole.

Source§

fn resolve(&self, r: &mut dyn Resolver) -> Result<Option<OwnedDataValue>>

The document rendered for this call.

Source§

fn compile(raw: &Value, cx: &mut CompileCx<'_>) -> Option<Self>

Compiles raw; None after recording at least one issue.
Source§

fn visit(&self, v: &mut Visit<'_>)

Reports the field’s expressions.
Source§

fn kind() -> FieldKind

What the field is.
Source§

const IS_OUTPUT: bool = false

Whether the field is an output: a destination its call writes to. false unless the type is Output or an Option of one. The derive reads a field typed Output or marked #[output] as an output and asserts that this is true, so a type that merely shares the name is refused at compile time.
Source§

fn absent() -> Option<Self>

The value when the key is absent and no default is declared. None makes the field required.
Source§

impl Debug for Interpolated

Source§

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

Formats the value using the given formatter. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.