dioxus/packages/core/src/bump_frame.rs

25 lines
490 B
Rust
Raw Normal View History

use std::cell::Cell;
use bumpalo::Bump;
2022-11-04 03:56:31 +00:00
use crate::factory::RenderReturn;
pub struct BumpFrame {
pub bump: Bump,
2022-11-04 03:56:31 +00:00
pub node: Cell<*mut RenderReturn<'static>>,
}
impl BumpFrame {
pub fn new(capacity: usize) -> Self {
let bump = Bump::with_capacity(capacity);
Self {
bump,
2022-11-04 03:56:31 +00:00
node: Cell::new(std::ptr::null_mut()),
}
}
pub fn reset(&mut self) {
self.bump.reset();
2022-11-04 03:56:31 +00:00
self.node.set(std::ptr::null_mut());
}
}