pub struct ViewRenderer { /* private fields */ }Expand description
Provider that renders view names into HTML responses.
Implementations§
Source§impl ViewRenderer
impl ViewRenderer
pub fn new<E>(engine: E) -> Selfwhere
E: ViewEngine,
pub fn from_engine_arc(engine: Arc<dyn ViewEngine>) -> Self
pub fn with_content_type(self, content_type: impl Into<String>) -> Self
pub fn content_type(&self) -> &str
pub async fn render<T>(
&self,
view: impl Into<String>,
context: &T,
) -> Result<String>where
T: Serialize,
pub async fn render_value( &self, view: impl Into<String>, context: Value, ) -> Result<String>
pub async fn render_response<T>(
&self,
view: impl Into<String>,
context: &T,
) -> Result<BootResponse>where
T: Serialize,
pub async fn render_response_with_status<T>(
&self,
status: u16,
view: impl Into<String>,
context: &T,
) -> Result<BootResponse>where
T: Serialize,
pub async fn render_value_response( &self, view: impl Into<String>, context: Value, ) -> Result<BootResponse>
pub async fn render_value_response_with_status( &self, status: u16, view: impl Into<String>, context: Value, ) -> Result<BootResponse>
Trait Implementations§
Source§impl Clone for ViewRenderer
impl Clone for ViewRenderer
Source§fn clone(&self) -> ViewRenderer
fn clone(&self) -> ViewRenderer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ViewRenderer
impl !UnwindSafe for ViewRenderer
impl Freeze for ViewRenderer
impl Send for ViewRenderer
impl Sync for ViewRenderer
impl Unpin for ViewRenderer
impl UnsafeUnpin for ViewRenderer
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