Destroy a `Stream`, returning an error. Destroying a stream can return errors from previous asynchronous work. This function destroys the given stream and returns the error and the un-destroyed stream on failure. # Example ``` # use cust::*; # use std::error::Error; # fn main() -> Result<(), Box > { # let _ctx = quick_init()?; use cust::stream::{Stream, StreamFlags}; let stream = Str
(mut stream: Stream)
| 310 | /// # } |
| 311 | /// ``` |
| 312 | pub fn drop(mut stream: Stream) -> DropResult<Stream> { |
| 313 | if stream.inner.is_null() { |
| 314 | return Ok(()); |
| 315 | } |
| 316 | |
| 317 | unsafe { |
| 318 | let inner = mem::replace(&mut stream.inner, ptr::null_mut()); |
| 319 | match cuda::cuStreamDestroy_v2(inner).to_result() { |
| 320 | Ok(()) => { |
| 321 | mem::forget(stream); |
| 322 | Ok(()) |
| 323 | } |
| 324 | Err(e) => Err((e, Stream { inner })), |
| 325 | } |
| 326 | } |
| 327 | } |
| 328 | } |
| 329 | impl Drop for Stream { |
| 330 | fn drop(&mut self) { |