Struct axum_template::Render
source · pub struct Render<K, E, S>(pub K, pub E, pub S);
Expand description
Rendered template response
Responds to the request with the rendered template and
text/plain; charset=utf-8
content-type
§Usage
use serde::Serialize;
#[derive(Serialize)]
struct Person { /* */ }
async fn handler(
engine: impl TemplateEngine,
) -> impl IntoResponse {
let key = "Template key";
let data = Person{ /* */ };
Render(key, engine, data)
}
Tuple Fields§
§0: K
§1: E
§2: S
Trait Implementations§
source§impl<K, E, S> From<Render<K, E, S>> for RenderHtml<K, E, S>
impl<K, E, S> From<Render<K, E, S>> for RenderHtml<K, E, S>
source§impl<K, E, S> From<RenderHtml<K, E, S>> for Render<K, E, S>
impl<K, E, S> From<RenderHtml<K, E, S>> for Render<K, E, S>
source§fn from(r: RenderHtml<K, E, S>) -> Self
fn from(r: RenderHtml<K, E, S>) -> Self
Converts to this type from the input type.
source§impl<K, E, S> IntoResponse for Render<K, E, S>
impl<K, E, S> IntoResponse for Render<K, E, S>
source§fn into_response(self) -> Response
fn into_response(self) -> Response
Create a response.
source§impl<K: PartialEq, E: PartialEq, S: PartialEq> PartialEq for Render<K, E, S>
impl<K: PartialEq, E: PartialEq, S: PartialEq> PartialEq for Render<K, E, S>
impl<K: Eq, E: Eq, S: Eq> Eq for Render<K, E, S>
impl<K, E, S> StructuralPartialEq for Render<K, E, S>
Auto Trait Implementations§
impl<K, E, S> Freeze for Render<K, E, S>
impl<K, E, S> RefUnwindSafe for Render<K, E, S>
impl<K, E, S> Send for Render<K, E, S>
impl<K, E, S> Sync for Render<K, E, S>
impl<K, E, S> Unpin for Render<K, E, S>
impl<K, E, S> UnwindSafe for Render<K, E, S>
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, S> Handler<IntoResponseHandler, S> for T
impl<T, S> Handler<IntoResponseHandler, S> for T
source§fn call(
self,
_req: Request<Body>,
_state: S
) -> <T as Handler<IntoResponseHandler, S>>::Future
fn call( self, _req: Request<Body>, _state: S ) -> <T as Handler<IntoResponseHandler, S>>::Future
Call the handler with the given request.
source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
Apply a
tower::Layer
to the handler. Read moresource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Convert the handler into a
Service
by providing the statesource§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Convert the handler into a
Service
and no state.source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
Convert the handler into a
MakeService
and no state. Read more