pub struct Html(/* private fields */);Expand description
HTML response with proper content-type.
§Examples
use fastapi_core::Html;
let response = Html::new("<html><body>Hello</body></html>");Implementations§
Source§impl Html
impl Html
Sourcepub fn new(content: impl Into<String>) -> Self
pub fn new(content: impl Into<String>) -> Self
Create a new HTML response from trusted content.
§Safety Note
This method does NOT escape the content. Only use with trusted HTML.
For user-provided content, use Html::escaped instead to prevent XSS.
Trait Implementations§
Source§impl IntoResponse for Html
impl IntoResponse for Html
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Convert into a response.
Auto Trait Implementations§
impl Freeze for Html
impl RefUnwindSafe for Html
impl Send for Html
impl Sync for Html
impl Unpin for Html
impl UnwindSafe for Html
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).