Destroy an `Event` returning an error. Destroying an event can return errors from previous asynchronous work. This function destroys the given event and returns the error and the un-destroyed event on failure. # Example ``` # use cust::*; # use std::error::Error; # fn main() -> Result<(), Box > { # let _context = quick_init()?; use cust::event::{Event, EventFlags}; let event = Event:
(mut event: Event)
| 327 | /// # } |
| 328 | /// ``` |
| 329 | pub fn drop(mut event: Event) -> DropResult<Event> { |
| 330 | if event.0.is_null() { |
| 331 | return Ok(()); |
| 332 | } |
| 333 | |
| 334 | unsafe { |
| 335 | let inner = mem::replace(&mut event.0, ptr::null_mut()); |
| 336 | match cuEventDestroy_v2(inner).to_result() { |
| 337 | Ok(()) => { |
| 338 | mem::forget(event); |
| 339 | Ok(()) |
| 340 | } |
| 341 | Err(e) => Err((e, Event(inner))), |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | impl Drop for Event { |