1use crate::cached_set::CachedSet;
5/// Common context available to all `Render` implementations.
7/// Notably, the `RenderContext` gives access to the bump arena that the virtual
8/// DOM should be allocated within. This is available via the `bump` field.
9pub struct RenderContext<'a> {
10 /// The underlying bump arena that virtual DOMs are rendered into.
15 /// use dodrio::RenderContext;
17 /// // Given a rendering context, allocate an i32 inside its bump arena.
18 /// fn foo<'a>(cx: &mut RenderContext<'a>) -> &'a mut i32 {
24 pub(crate) cached_set: &'a crate::RefCell<CachedSet>,
26 // Prevent exhaustive matching on the rendering context, so we can always
27 // add more members in a semver-compatible way.
31impl fmt::Debug for RenderContext<'_> {
32 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
33 f.debug_struct("RenderContext")
34 .field("bump", &self.bump)
39impl<'a> RenderContext<'a> {
40 pub_unstable_internal! {
41 pub(crate) fn new(bump: &'a Bump, cached_set: &'a crate::RefCell<CachedSet>) -> Self {
51impl<'a, 'b> From<&'b RenderContext<'a>> for &'a Bump {
53 fn from(cx: &'b RenderContext<'a>) -> &'a Bump {
58impl<'a, 'b, 'c> From<&'c &'b mut RenderContext<'a>> for &'a Bump {
60 fn from(cx: &'c &'b mut RenderContext<'a>) -> &'a Bump {
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list