Skip to main content

Render

Trait Render 

Source
pub trait Render<T: PrimaryData> {
    // Required method
    fn render(self, query: Option<&Query>) -> Result<Document<T>, Error>;
}
Expand description

A trait to render a given type as a document.

This trait is automatically implemented for any type which implements Resource.

Required Methods§

Source

fn render(self, query: Option<&Query>) -> Result<Document<T>, Error>

Attempts to render the given type as a document.

Types that implement the Resource trait via the resource! macro can use the optional query argument to match object field-sets and included resources with what is present in the query.

If a query does not have a matching field-set for a given type and the type in question is a part of the document’s primary data or included resources, each attribute specified in the type’s resource! macro invocation will be used.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Render<Identifier> for Vec<Identifier>

Source§

impl Render<Identifier> for Vec<Object>

Source§

impl Render<Object> for Vec<Object>

Source§

impl<'a, T: Resource> Render<Identifier> for &'a T

Source§

impl<'a, T: Resource> Render<Identifier> for &'a [T]

Source§

impl<'a, T: Resource> Render<Object> for &'a T

Source§

impl<'a, T: Resource> Render<Object> for &'a [T]

Source§

impl<D, T> Render<D> for Option<T>
where D: PrimaryData, T: Render<D> + Sized,

Source§

fn render(self, query: Option<&Query>) -> Result<Document<D>, Error>

Implementors§