pub struct BufferRegistry<T> { /* private fields */ }Expand description
Registry of named buffers.
Used in GraphBuilder::build() to allocate resources and distribute
pointers to graph nodes.
Implementations§
Source§impl<T> BufferRegistry<T>
impl<T> BufferRegistry<T>
Sourcepub fn register(
&mut self,
name: impl Into<String>,
buffer: Box<dyn Buffer<T> + Send>,
)
pub fn register( &mut self, name: impl Into<String>, buffer: Box<dyn Buffer<T> + Send>, )
Register a named buffer.
Sourcepub fn get_ptr(&self, name: &str) -> Option<*const dyn Buffer<T> + Send>
pub fn get_ptr(&self, name: &str) -> Option<*const dyn Buffer<T> + Send>
Get a raw pointer to a buffer by name.
Used to distribute pointers to graph nodes during build.
Sourcepub fn take(&mut self, name: &str) -> Option<Box<dyn Buffer<T> + Send>>
pub fn take(&mut self, name: &str) -> Option<Box<dyn Buffer<T> + Send>>
Take ownership of a buffer by name, removing it from the registry.
Sourcepub fn leak(&mut self, name: &str) -> Option<*mut dyn Buffer<T> + Send>
pub fn leak(&mut self, name: &str) -> Option<*mut dyn Buffer<T> + Send>
Leak a buffer by name, returning a raw mutable pointer. The leaked buffer will live for the remainder of the program (or until manually re‑boxed and dropped).
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for BufferRegistry<T>
impl<T> !RefUnwindSafe for BufferRegistry<T>
impl<T> Send for BufferRegistry<T>
impl<T> !Sync for BufferRegistry<T>
impl<T> Unpin for BufferRegistry<T>
impl<T> UnsafeUnpin for BufferRegistry<T>
impl<T> !UnwindSafe for BufferRegistry<T>
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