Skip to main content

BufferRegistry

Struct BufferRegistry 

Source
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>

Source

pub fn new() -> Self

Create an empty registry.

Source

pub fn register( &mut self, name: impl Into<String>, buffer: Box<dyn Buffer<T> + Send>, )

Register a named buffer.

Source

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.

Source

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.

Source

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).

Source

pub fn into_inner(self) -> Vec<Box<dyn Buffer<T> + Send>>

Consume the registry and return all owned buffers.

Source

pub fn len(&self) -> usize

Number of registered buffers.

Source

pub fn is_empty(&self) -> bool

Whether no buffers are registered.

Trait Implementations§

Source§

impl<T> Default for BufferRegistry<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to &dyn std::any::Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert to &mut dyn std::any::Any
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V