Skip to main content

Rendered

Struct Rendered 

Source
pub struct Rendered<'s> { /* private fields */ }
Expand description

An Interpolated document with its holes resolved, borrowed from the compiled document and the context the call sees.

Made by Ctx::render. Each hole was looked up once, when it was made; serializing writes the document’s skeleton with each hole’s value in place, straight into the serializer (BSON, SQL parameters, JWT claims, JSON), and builds no tree. Rendered::to_owned builds one for the caller that needs it.

Implementations§

Source§

impl Rendered<'_>

Source

pub fn to_owned(&self) -> OwnedDataValue

The document as a tree, each hole’s value copied in.

It serializes as the Rendered does, but for one value: an integer literal above i64::MAX, which OwnedDataValue holds as a float. So 18446744073709551615 is written with its digits by the Rendered and as 1.8446744073709552e+19 by this tree.

Trait Implementations§

Source§

impl Debug for Rendered<'_>

Source§

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

The document as authored and how many holes it filled; never their values.

Source§

impl Serialize for Rendered<'_>

Source§

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

The skeleton with each hole’s value in place: a literal subtree as its serde_json::Value holds it, objects and arrays entry by entry. An object’s keys, a literal’s or not, come out as authored, in every build: a Mongo {"$sort": {"created": -1, "_id": 1}} keeps its sort order (3.x’s default build sorted the keys).

Auto Trait Implementations§

§

impl<'s> Freeze for Rendered<'s>

§

impl<'s> RefUnwindSafe for Rendered<'s>

§

impl<'s> Send for Rendered<'s>

§

impl<'s> Sync for Rendered<'s>

§

impl<'s> Unpin for Rendered<'s>

§

impl<'s> UnsafeUnpin for Rendered<'s>

§

impl<'s> UnwindSafe for Rendered<'s>

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.