Skip to main content

ForeignOwner

Type Alias ForeignOwner 

Source
pub type ForeignOwner = Box<dyn Any + Send + Sync>;
Expand description

Opaque keep-alive handle for a foreign-memory tensor (see Tensor::from_foreign / TensorDyn::from_foreign_ptr).

The HAL borrows the foreign buffer without owning it; this handle co-owns the source so the borrowed memory stays valid for the tensor’s life. Its Drop releases the source — e.g. a small struct that calls cudaFreeHost, or a Py<PyAny> that decrements a NumPy array’s refcount. Wrapping it in an Arc (then boxing each clone) makes the release fire exactly once, after the last sharing tensor/view/map drops, regardless of drop order.

Aliased Type§

pub struct ForeignOwner(/* private fields */);