pub struct Fetched(pub Document);http only.Expand description
200 OK with a document.
Named Fetched rather than Ok: a handler returns
Result<Fetched, Errors>, and a type called Ok in that position
shadows Result::Ok at every call site.
Tuple Fields§
§0: DocumentImplementations§
Source§impl Fetched
impl Fetched
Sourcepub fn one(resource: ResourceObject) -> Self
pub fn one(resource: ResourceObject) -> Self
One resource.
Sourcepub fn many(resources: Vec<ResourceObject>) -> Self
pub fn many(resources: Vec<ResourceObject>) -> Self
A collection.
Sourcepub fn page(
resources: Vec<ResourceObject>,
links: Links,
total: Option<usize>,
) -> Self
pub fn page( resources: Vec<ResourceObject>, links: Links, total: Option<usize>, ) -> Self
One page of a collection, with its pagination links.
Built by the generated LIST handler from what
List::list returned. total becomes
meta.total when storage counted the collection, so a client can size
a pager without walking it.
Sourcepub fn in_context(self, ctx: &Context) -> Self
pub fn in_context(self, ctx: &Context) -> Self
Record the negotiated locale on the document’s top-level meta.
A no-op when the request sent no Accept-Language this crate could
parse, so a response carries lang only when there was one to carry.
The rest of meta is left alone — a paged listing keeps its total.
Applied by the generated handlers; call it on a hand-written one to get the same behaviour.