1
+ //! Legacy (old) context management which preceded primary contexts.
2
+ //!
1
3
//! # CUDA context management
2
4
//!
3
5
//! Most CUDA functions require a context. A CUDA context is analogous to a CPU process - it's
38
40
//!
39
41
//! ```
40
42
//! use cust::device::Device;
41
- //! use cust::context::{Context, ContextFlags};
43
+ //! use cust::context::legacy:: {Context, ContextFlags};
42
44
//! # use std::error::Error;
43
45
//! # fn main () -> Result<(), Box<dyn Error>> {
44
46
//!
57
59
//! to the single context and pass it to each thread.
58
60
//!
59
61
//! ```
60
- //! # use cust::context::{Context, ContextFlags, CurrentContext};
62
+ //! # use cust::context::legacy:: {Context, ContextFlags, CurrentContext};
61
63
//! # use cust::device::Device;
62
64
//! # use std::error::Error;
63
65
//! # fn main() -> Result<(), Box<dyn Error>> {
90
92
//!
91
93
//! ```
92
94
//! # use cust::device::Device;
93
- //! # use cust::context::{Context, ContextStack, ContextFlags, CurrentContext};
95
+ //! # use cust::context::legacy:: {Context, ContextStack, ContextFlags, CurrentContext};
94
96
//! # use std::error::Error;
95
97
//! #
96
98
//! # fn main() -> Result<(), Box<dyn Error>> {
112
114
//! # }
113
115
//! ```
114
116
117
+ use crate :: context:: ContextHandle ;
115
118
use crate :: device:: Device ;
116
119
use crate :: error:: { CudaResult , DropResult , ToResult } ;
117
120
use crate :: private:: Sealed ;
@@ -240,7 +243,7 @@ impl Context {
240
243
///
241
244
/// ```
242
245
/// # use cust::device::Device;
243
- /// # use cust::context::{Context, ContextFlags};
246
+ /// # use cust::context::legacy:: {Context, ContextFlags};
244
247
/// # use std::error::Error;
245
248
/// #
246
249
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -270,7 +273,7 @@ impl Context {
270
273
///
271
274
/// ```
272
275
/// # use cust::device::Device;
273
- /// # use cust::context::{Context, ContextFlags};
276
+ /// # use cust::context::legacy:: {Context, ContextFlags};
274
277
/// # use std::error::Error;
275
278
/// #
276
279
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -300,7 +303,7 @@ impl Context {
300
303
////* */
301
304
/// ```
302
305
/// # use cust::device::Device;
303
- /// # use cust::context::{Context, ContextFlags};
306
+ /// # use cust::context::legacy:: {Context, ContextFlags};
304
307
/// # use std::error::Error;
305
308
/// #
306
309
/// # fn main() -> Result<(), Box<dyn Error>> {
@@ -324,7 +327,7 @@ impl Context {
324
327
///
325
328
/// ```
326
329
/// # use cust::device::Device;
327
- /// # use cust::context::{Context, ContextFlags};
330
+ /// # use cust::context::legacy:: {Context, ContextFlags};
328
331
/// # use std::error::Error;
329
332
/// #
330
333
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -371,11 +374,6 @@ impl Drop for Context {
371
374
}
372
375
}
373
376
374
- /// Sealed trait for `Context` and `UnownedContext`. Not intended for use outside of cust.
375
- pub trait ContextHandle : Sealed {
376
- #[ doc( hidden) ]
377
- fn get_inner ( & self ) -> CUcontext ;
378
- }
379
377
impl Sealed for Context { }
380
378
impl ContextHandle for Context {
381
379
fn get_inner ( & self ) -> CUcontext {
@@ -405,7 +403,7 @@ impl UnownedContext {
405
403
///
406
404
/// ```
407
405
/// # use cust::device::Device;
408
- /// # use cust::context::{Context, ContextFlags};
406
+ /// # use cust::context::legacy:: {Context, ContextFlags};
409
407
/// # use std::error::Error;
410
408
/// #
411
409
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -440,7 +438,7 @@ impl ContextStack {
440
438
///
441
439
/// ```
442
440
/// # use cust::device::Device;
443
- /// # use cust::context::{Context, ContextFlags, ContextStack};
441
+ /// # use cust::context::legacy :: {Context, ContextFlags, ContextStack};
444
442
/// # use std::error::Error;
445
443
/// #
446
444
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -466,7 +464,7 @@ impl ContextStack {
466
464
///
467
465
/// ```
468
466
/// # use cust::device::Device;
469
- /// # use cust::context::{Context, ContextFlags, ContextStack};
467
+ /// # use cust::context::legacy:: {Context, ContextFlags, ContextStack};
470
468
/// # use std::error::Error;
471
469
/// #
472
470
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -513,7 +511,7 @@ impl CurrentContext {
513
511
///
514
512
/// ```
515
513
/// # use cust::device::Device;
516
- /// # use cust::context::{ Context, ContextFlags, CurrentContext };
514
+ /// # use cust::context::legacy:: { Context, ContextFlags, CurrentContext };
517
515
/// # use std::error::Error;
518
516
/// #
519
517
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -539,7 +537,7 @@ impl CurrentContext {
539
537
///
540
538
/// ```
541
539
/// # use cust::device::Device;
542
- /// # use cust::context::{ Context, ContextFlags, CurrentContext };
540
+ /// # use cust::context::legacy:: { Context, ContextFlags, CurrentContext };
543
541
/// # use std::error::Error;
544
542
/// #
545
543
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -564,7 +562,7 @@ impl CurrentContext {
564
562
///
565
563
/// ```
566
564
/// # use cust::device::Device;
567
- /// # use cust::context::{ Context, ContextFlags, CurrentContext };
565
+ /// # use cust::context::legacy:: { Context, ContextFlags, CurrentContext };
568
566
/// # use std::error::Error;
569
567
/// #
570
568
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -589,7 +587,7 @@ impl CurrentContext {
589
587
///
590
588
/// ```
591
589
/// # use cust::device::Device;
592
- /// # use cust::context::{ Context, ContextFlags, CurrentContext, ResourceLimit };
590
+ /// # use cust::context::legacy:: { Context, ContextFlags, CurrentContext, ResourceLimit };
593
591
/// # use std::error::Error;
594
592
/// #
595
593
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -614,7 +612,7 @@ impl CurrentContext {
614
612
///
615
613
/// ```
616
614
/// # use cust::device::Device;
617
- /// # use cust::context::{ Context, ContextFlags, CurrentContext, ResourceLimit };
615
+ /// # use cust::context::legacy:: { Context, ContextFlags, CurrentContext, ResourceLimit };
618
616
/// # use std::error::Error;
619
617
/// #
620
618
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -646,7 +644,7 @@ impl CurrentContext {
646
644
///
647
645
/// ```
648
646
/// # use cust::device::Device;
649
- /// # use cust::context::{ Context, ContextFlags, CurrentContext};
647
+ /// # use cust::context::legacy:: { Context, ContextFlags, CurrentContext};
650
648
/// # use std::error::Error;
651
649
/// #
652
650
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -686,7 +684,7 @@ impl CurrentContext {
686
684
///
687
685
/// ```
688
686
/// # use cust::device::Device;
689
- /// # use cust::context::{ Context, ContextFlags, CurrentContext, CacheConfig };
687
+ /// # use cust::context::legacy:: { Context, ContextFlags, CurrentContext, CacheConfig };
690
688
/// # use std::error::Error;
691
689
/// #
692
690
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -730,7 +728,7 @@ impl CurrentContext {
730
728
///
731
729
/// ```
732
730
/// # use cust::device::Device;
733
- /// # use cust::context::{ Context, ContextFlags, CurrentContext, ResourceLimit };
731
+ /// # use cust::context::legacy:: { Context, ContextFlags, CurrentContext, ResourceLimit };
734
732
/// # use std::error::Error;
735
733
/// #
736
734
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -757,7 +755,7 @@ impl CurrentContext {
757
755
///
758
756
/// ```
759
757
/// # use cust::device::Device;
760
- /// # use cust::context::{ Context, ContextFlags, CurrentContext, SharedMemoryConfig };
758
+ /// # use cust::context::legacy:: { Context, ContextFlags, CurrentContext, SharedMemoryConfig };
761
759
/// # use std::error::Error;
762
760
/// #
763
761
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -778,7 +776,7 @@ impl CurrentContext {
778
776
///
779
777
/// ```
780
778
/// # use cust::device::Device;
781
- /// # use cust::context::{ Context, ContextFlags, CurrentContext };
779
+ /// # use cust::context::legacy:: { Context, ContextFlags, CurrentContext };
782
780
/// # use std::error::Error;
783
781
/// #
784
782
/// # fn main () -> Result<(), Box<dyn Error>> {
@@ -807,7 +805,7 @@ impl CurrentContext {
807
805
///
808
806
/// ```
809
807
/// # use cust::device::Device;
810
- /// # use cust::context::{ Context, ContextFlags, CurrentContext };
808
+ /// # use cust::context::legacy:: { Context, ContextFlags, CurrentContext };
811
809
/// # use std::error::Error;
812
810
/// #
813
811
/// # fn main () -> Result<(), Box<dyn Error>> {
0 commit comments