pub trait BackendBuffer<T>:
Debug
+ Send
+ Sync
+ 'static {
// Required methods
fn backend_family(&self) -> &'static str;
fn len(&self) -> usize;
fn as_any(&self) -> &dyn Any;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Opaque backend-owned tensor buffer.
Tensor core never inspects backend-native allocations directly. Backend crates store their own concrete handle types behind this trait and downcast inside the owning backend only.
§Examples
use std::sync::Arc;
use tenferro_tensor::{BackendBuffer, BufferHandle};
let buffer: Arc<dyn BackendBuffer<f64>> = Arc::new(BufferHandle::<f64>::new_with_len(7, 2));
assert_eq!(buffer.backend_family(), "opaque");
assert_eq!(buffer.len(), 2);Required Methods§
Sourcefn backend_family(&self) -> &'static str
fn backend_family(&self) -> &'static str
Stable backend family identifier.