Struct axum_template::RenderHtml

source ·
pub struct RenderHtml<K, E, S>(pub K, pub E, pub S);
Expand description

Rendered Html response

Responds to the request with the rendered template and text/html 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{ /* */ };
    RenderHtml(key, engine, data)
}

Tuple Fields§

§0: K§1: E§2: S

Trait Implementations§

source§

impl<K: Clone, E: Clone, S: Clone> Clone for RenderHtml<K, E, S>

source§

fn clone(&self) -> RenderHtml<K, E, S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<K: Debug, E: Debug, S: Debug> Debug for RenderHtml<K, E, S>

source§

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

Formats the value using the given formatter. Read more
source§

impl<K, E, S> From<(K, E, S)> for RenderHtml<K, E, S>

source§

fn from((k, e, s): (K, E, S)) -> Self

Converts to this type from the input type.
source§

impl<K, E, S> From<Render<K, E, S>> for RenderHtml<K, E, S>

source§

fn from(r: Render<K, E, S>) -> Self

Converts to this type from the input type.
source§

impl<K, E, S> From<RenderHtml<K, E, S>> for Render<K, E, S>

source§

fn from(r: RenderHtml<K, E, S>) -> Self

Converts to this type from the input type.
source§

impl<K, E, S> IntoResponse for RenderHtml<K, E, S>
where E: TemplateEngine, S: Serialize, K: AsRef<str>,

source§

fn into_response(self) -> Response

Create a response.
source§

impl<K: PartialEq, E: PartialEq, S: PartialEq> PartialEq for RenderHtml<K, E, S>

source§

fn eq(&self, other: &RenderHtml<K, E, S>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<K: Eq, E: Eq, S: Eq> Eq for RenderHtml<K, E, S>

source§

impl<K, E, S> StructuralPartialEq for RenderHtml<K, E, S>

Auto Trait Implementations§

§

impl<K, E, S> Freeze for RenderHtml<K, E, S>
where K: Freeze, E: Freeze, S: Freeze,

§

impl<K, E, S> RefUnwindSafe for RenderHtml<K, E, S>

§

impl<K, E, S> Send for RenderHtml<K, E, S>
where K: Send, E: Send, S: Send,

§

impl<K, E, S> Sync for RenderHtml<K, E, S>
where K: Sync, E: Sync, S: Sync,

§

impl<K, E, S> Unpin for RenderHtml<K, E, S>
where K: Unpin, E: Unpin, S: Unpin,

§

impl<K, E, S> UnwindSafe for RenderHtml<K, E, S>
where K: UnwindSafe, E: UnwindSafe, S: UnwindSafe,

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> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T, S> Handler<IntoResponseHandler, S> for T
where T: IntoResponse + Clone + Send + 'static,

§

type Future = Ready<Response<Body>>

The type of future calling this handler returns.
source§

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>>,

Apply a tower::Layer to the handler. Read more
source§

fn with_state(self, state: S) -> HandlerService<Self, T, S>

Convert the handler into a Service by providing the state
source§

impl<H, T> HandlerWithoutStateExt<T> for H
where H: Handler<T, ()>,

source§

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, ()>>

Convert the handler into a MakeService and no state. Read more
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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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.