Lines Matching refs:Cfg
6 pub struct Cfg<'a> {
309 pub static mut CFG: Cfg = Cfg {
318 impl<'a> Debug for Cfg<'a> {
329 .debug_struct("Cfg")
340 pub use self::r#impl::Cfg::CFG;
386 // instance directly own the associated super::Cfg.
389 // pub const CFG: Cfg = Cfg {
392 // pub struct Cfg {
393 // cfg: AtomicPtr<super::Cfg>,
396 static CONST_DEREFS: RefCell<Map<Handle, Box<super::Cfg<'static>>>> = RefCell::default();
400 struct Handle(*const Cfg<'static>);
402 impl<'a> Cfg<'a> {
403 fn current() -> super::Cfg<'a> {
410 super::Cfg {
420 const fn handle(self: &Cfg<'a>) -> Handle {
421 Handle(<*const Cfg>::cast(self))
425 // Since super::Cfg is !Send and !Sync, all Cfg are thread local and will
427 pub enum Cfg<'a> {
428 Mut(super::Cfg<'a>),
432 impl<'a> Debug for Cfg<'a> {
434 if let Cfg::Mut(cfg) = self {
437 Debug::fmt(&Cfg::current(), formatter)
442 impl<'a> Deref for Cfg<'a> {
443 type Target = super::Cfg<'a>;
446 if let Cfg::Mut(cfg) = self {
449 let cfg = CONST_DEREFS.with(|derefs| -> *mut super::Cfg {
453 .or_insert_with(|| Box::new(Cfg::current()))
460 impl<'a> DerefMut for Cfg<'a> {
462 if let Cfg::CFG = self {
464 *self = Cfg::Mut(Cfg::current());
467 Cfg::Mut(cfg) => cfg,
468 Cfg::CFG => unreachable!(),
473 impl<'a> Drop for Cfg<'a> {
475 if let Cfg::Mut(cfg) = self {
476 let super::Cfg {