pub struct BufferHandle<T> { /* private fields */ }Expand description
Backend-owned buffer handle.
BufferHandle::new creates an empty opaque handle. Use
BufferHandle::new_with_len when test or adapter code needs to model a
non-empty backend allocation.
§Examples
use tenferro_tensor::BufferHandle;
let handle = BufferHandle::<f64>::new(7);Implementations§
Source§impl<T> BufferHandle<T>
impl<T> BufferHandle<T>
Sourcepub fn new(id: u64) -> Self
pub fn new(id: u64) -> Self
Create a new backend buffer handle.
§Examples
use tenferro_tensor::BufferHandle;
let handle = BufferHandle::<f64>::new(1);
assert_eq!(tenferro_tensor::BackendBuffer::len(&handle), 0);Sourcepub fn new_with_len(id: u64, len: usize) -> Self
pub fn new_with_len(id: u64, len: usize) -> Self
Create a new backend buffer handle with a logical element count.
§Examples
use tenferro_tensor::{BackendBuffer, BufferHandle};
let handle = BufferHandle::<f64>::new_with_len(1, 4);
assert_eq!(BackendBuffer::len(&handle), 4);Trait Implementations§
Source§impl<T: Send + Sync + 'static> BackendBuffer<T> for BufferHandle<T>
impl<T: Send + Sync + 'static> BackendBuffer<T> for BufferHandle<T>
Source§fn backend_family(&self) -> &'static str
fn backend_family(&self) -> &'static str
Stable backend family identifier.
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Type-erased access for the backend crate that owns the concrete handle.
Source§fn allocation_domain(&self) -> Option<AllocationDomainId>
fn allocation_domain(&self) -> Option<AllocationDomainId>
Return the shared-allocation domain, when this buffer belongs to one.
Source§fn allocation_id(&self) -> Option<AllocationId>
fn allocation_id(&self) -> Option<AllocationId>
Return the stable physical allocation identity, when available.
Source§fn map_read(&self) -> Result<HostReadGuard<'_, T>, HostAccessError>
fn map_read(&self) -> Result<HostReadGuard<'_, T>, HostAccessError>
Map the allocation for closure-scoped host reads. Read more
Source§fn map_write(&self) -> Result<HostWriteGuard<'_, T>, HostAccessError>
fn map_write(&self) -> Result<HostWriteGuard<'_, T>, HostAccessError>
Map the allocation for closure-scoped host writes. Read more
Source§impl<T: Clone> Clone for BufferHandle<T>
impl<T: Clone> Clone for BufferHandle<T>
Source§fn clone(&self) -> BufferHandle<T>
fn clone(&self) -> BufferHandle<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for BufferHandle<T>
impl<T> RefUnwindSafe for BufferHandle<T>where
T: RefUnwindSafe,
impl<T> Send for BufferHandle<T>where
T: Send,
impl<T> Sync for BufferHandle<T>where
T: Sync,
impl<T> Unpin for BufferHandle<T>where
T: Unpin,
impl<T> UnsafeUnpin for BufferHandle<T>
impl<T> UnwindSafe for BufferHandle<T>where
T: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more