Struct dioxus_fullstack::prelude::IncrementalRenderer
source · pub struct IncrementalRenderer { /* private fields */ }Available on crate feature
server only.Expand description
An incremental renderer.
Implementations§
source§impl IncrementalRenderer
impl IncrementalRenderer
sourcepub fn builder() -> IncrementalRendererConfig
pub fn builder() -> IncrementalRendererConfig
Create a new incremental renderer builder.
sourcepub fn invalidate(&mut self, route: &str)
pub fn invalidate(&mut self, route: &str)
Remove a route from the cache.
sourcepub fn invalidate_all(&mut self)
pub fn invalidate_all(&mut self)
Remove all routes from the cache.
sourcepub fn cache(
&mut self,
route: String,
html: impl Into<Vec<u8>>,
) -> Result<RenderFreshness, IncrementalRendererError>
pub fn cache( &mut self, route: String, html: impl Into<Vec<u8>>, ) -> Result<RenderFreshness, IncrementalRendererError>
Cache a rendered response.
let route = "/index".to_string();
let response = b"<html><body>Hello world</body></html>";
renderer.cache(route, response).unwrap();sourcepub fn get<'a>(
&'a mut self,
route: &str,
) -> Result<Option<CachedRender<'a>>, IncrementalRendererError>
pub fn get<'a>( &'a mut self, route: &str, ) -> Result<Option<CachedRender<'a>>, IncrementalRendererError>
Try to get a cached response for a route.
let route = "/index";
let response = renderer.get(route).unwrap();
assert_eq!(response.unwrap().response, b"<html><body>Hello world</body></html>");If the route is not cached, None is returned.
let route = "/index";
let response = renderer.get(route).unwrap();
assert!(response.is_none());Auto Trait Implementations§
impl Freeze for IncrementalRenderer
impl !RefUnwindSafe for IncrementalRenderer
impl Send for IncrementalRenderer
impl Sync for IncrementalRenderer
impl Unpin for IncrementalRenderer
impl !UnwindSafe for IncrementalRenderer
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.