pub struct Html<T>(pub T);Expand description
HTML response wrapper
Wraps any type that can be converted to a String and sets the Content-Type to text/html.
§Example
async fn handler() -> Html<String> {
Html("<h1>Hello</h1>".to_string())
}Tuple Fields§
§0: TTrait Implementations§
Source§impl<T> IntoResponse for Html<T>
Convert Html into an HTML response
impl<T> IntoResponse for Html<T>
Convert Html
Sets Content-Type to text/html; charset=utf-8 and converts the inner value to bytes.
§Example
Html("<html><body>Hello</body></html>")Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Convert this type into an HTTP response. Read more
Auto Trait Implementations§
impl<T> Freeze for Html<T>where
T: Freeze,
impl<T> RefUnwindSafe for Html<T>where
T: RefUnwindSafe,
impl<T> Send for Html<T>where
T: Send,
impl<T> Sync for Html<T>where
T: Sync,
impl<T> Unpin for Html<T>where
T: Unpin,
impl<T> UnwindSafe for Html<T>where
T: UnwindSafe,
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