MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / drop

Method drop

crates/blastoff/src/context.rs:95–110  ·  view source on GitHub ↗

Tries to destroy a [`CublasContext`], returning an error if it fails.

(mut ctx: CublasContext)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 2

is_nullMethod · 0.80
to_resultMethod · 0.45

Tested by

no test coverage detected