pub struct BackendStorageHandle<T> { /* private fields */ }Expand description
Backend-owned buffer handle.
BackendStorageHandle::new creates an empty opaque handle. Use
BackendStorageHandle::new_with_len when test or adapter code needs to model a
non-empty backend allocation.
§Examples
use tenferro_tensor::BackendStorageHandle;
let handle = BackendStorageHandle::<f64>::new(7);Implementations§
Source§impl<T> BackendStorageHandle<T>
impl<T> BackendStorageHandle<T>
Sourcepub fn new(id: u64) -> Self
pub fn new(id: u64) -> Self
Create a new backend buffer handle.
§Examples
use tenferro_tensor::BackendStorageHandle;
let handle = BackendStorageHandle::<f64>::new(1);
assert_eq!(tenferro_tensor::BackendStorage::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::{BackendStorage, BackendStorageHandle};
let handle = BackendStorageHandle::<f64>::new_with_len(1, 4);
assert_eq!(BackendStorage::len(&handle), 4);Trait Implementations§
Source§impl<T: Send + Sync + 'static> BackendStorage<T> for BackendStorageHandle<T>
impl<T: Send + Sync + 'static> BackendStorage<T> for BackendStorageHandle<T>
Source§fn backend_family(&self) -> &'static str
fn backend_family(&self) -> &'static str
Stable backend family identifier.
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 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 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(&mut self) -> Result<HostWriteGuard<'_, T>, HostAccessError>
fn map_write(&mut self) -> Result<HostWriteGuard<'_, T>, HostAccessError>
Map the allocation for closure-scoped host writes. Read more
Auto Trait Implementations§
impl<T> Freeze for BackendStorageHandle<T>
impl<T> RefUnwindSafe for BackendStorageHandle<T>where
T: RefUnwindSafe,
impl<T> Send for BackendStorageHandle<T>where
T: Send,
impl<T> Sync for BackendStorageHandle<T>where
T: Sync,
impl<T> Unpin for BackendStorageHandle<T>where
T: Unpin,
impl<T> UnsafeUnpin for BackendStorageHandle<T>
impl<T> UnwindSafe for BackendStorageHandle<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> 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