pub unsafe fn with_stream<T>(
device: &DLDevice,
stream: TVMFFIStreamHandle,
f: impl FnOnce() -> Result<T>,
) -> Result<T>Expand description
Call f with the device stream temporarily set to stream.
The previous stream is restored however f exits: when it returns a
value, when it returns an error, and when it panics.
ยงSafety
stream must be a valid stream handle for the given device, or null.