We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1935bbf commit c47e0fcCopy full SHA for c47e0fc
crates/cust/src/context/mod.rs
@@ -166,6 +166,18 @@ pub struct Context {
166
device: cuda::CUdevice,
167
}
168
169
+impl Clone for Context {
170
+ fn clone(&self) -> Self {
171
+ // because we already retained a context on this device successfully (self), it is
172
+ // exceedingly rare that this function would fail, therefore a silent panic
173
+ // is mostly okay
174
+ Self::new(Device {
175
+ device: self.device,
176
+ })
177
+ .expect("Failed to clone context")
178
+ }
179
+}
180
+
181
impl Context {
182
/// Retains the primary context for this device and makes it current, incrementing the internal reference cycle
183
/// that CUDA keeps track of. There is only one primary context associated with a device, multiple
0 commit comments