Tries to destroy a [`CublasContext`], returning an error if it fails.
(mut ctx: CublasContext)
| 93 | |
| 94 | /// Tries to destroy a [`CublasContext`], returning an error if it fails. |
| 95 | pub fn drop(mut ctx: CublasContext) -> DropResult<CublasContext> { |
| 96 | if ctx.raw.is_null() { |
| 97 | return Ok(()); |
| 98 | } |
| 99 | |
| 100 | unsafe { |
| 101 | let inner = mem::replace(&mut ctx.raw, ptr::null_mut()); |
| 102 | match sys::v2::cublasDestroy_v2(inner).to_result() { |
| 103 | Ok(()) => { |
| 104 | mem::forget(ctx); |
| 105 | Ok(()) |
| 106 | } |
| 107 | Err(e) => Err((e, CublasContext { raw: inner })), |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | /// Returns the major, minor, and patch versions of the cuBLAS library. |
| 113 | pub fn version(&self) -> (u32, u32, u32) { |