// Copyright (c) the JPEG XL Project Authors. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.
#![allow(unsafe_code)]
use std::cell::UnsafeCell; use std::sync::atomic::AtomicUsize;
// SAFETY: Accesses to the inner data are synchronized by the atomic reference counter. unsafeimpl<T: ?Sized + Send> Send for AtomicRefCell<T> {}
// SAFETY: Accesses to the inner data are synchronized by the atomic reference counter. Additional // `Send` bound is needed because `AtomicRefCell` provides mutable access behind a shared reference. unsafeimpl<T: ?Sized + Send + Sync> Sync for AtomicRefCell<T> {}
impl<T: std::fmt::Debug> std::fmt::Debug for AtomicRefCell<T> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let val = self.try_borrow(); iflet Some(val) = val {
f.debug_tuple("AtomicRefCell").field(&*val).finish()
} else {
f.debug_tuple("AtomicRefCell")
.field(&format_args!("[borrowed]"))
.finish()
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.