Tracking Issue for once_cell
· Issue #74465 · rust-lang/rust (original) (raw)
This is a tracking issue for the RFC "standard lazy types" (rust-lang/rfcs#2788).
The feature gate for the issue is #![feature(once_cell)]
.
// core::lazy
pub struct OnceCell { .. }
impl OnceCell { pub const fn new() -> OnceCell; pub fn get(&self) -> Option<&T>; pub fn get_mut(&mut self) -> Option<&mut T>; pub fn set(&self, value: T) -> Result<(), T>; pub fn get_or_init(&self, f: F) -> &T where F: FnOnce() -> T; pub fn get_or_try_init<F, E>(&self, f: F) -> Result<&T, E> where F: FnOnce() -> Result<T, E>; pub fn into_inner(self) -> Option; pub fn take(&mut self) -> Option; } impl From for OnceCell; impl Default for OnceCell; impl<T: Clone> Clone for OnceCell; impl<T: PartialEq> PartialEq for OnceCell; impl<T: Eq> Eq for OnceCell; impl<T: fmt::Debug> fmt::Debug for OnceCell;
pub struct Lazy<T, F = fn() -> T> { .. }
impl<T, F> Lazy<T, F> { pub const fn new(init: F) -> Lazy<T, F>; } impl<T, F: FnOnce() -> T> Lazy<T, F> { pub fn force(this: &Lazy<T, F>) -> &T; } impl<T: Default> Default for Lazy; impl<T, F: FnOnce() -> T> Deref for Lazy<T, F>; impl<T: fmt::Debug, F> fmt::Debug for Lazy<T, F>;
// std::lazy
pub struct SyncOnceCell { .. }
impl SyncOnceCell { pub const fn new() -> SyncOnceCell; pub fn get(&self) -> Option<&T>; pub fn get_mut(&mut self) -> Option<&mut T>; pub fn set(&self, value: T) -> Result<(), T>; pub fn get_or_init(&self, f: F) -> &T where F: FnOnce() -> T; pub fn get_or_try_init<F, E>(&self, f: F) -> Result<&T, E> where F: FnOnce() -> Result<T, E>; pub fn into_inner(mut self) -> Option; pub fn take(&mut self) -> Option; fn is_initialized(&self) -> bool; fn initialize<F, E>(&self, f: F) -> Result<(), E> where F: FnOnce() -> Result<T, E>; unsafe fn get_unchecked(&self) -> &T; unsafe fn get_unchecked_mut(&mut self) -> &mut T; } impl From for SyncOnceCell; impl Default for SyncOnceCell; impl<T: RefUnwindSafe + UnwindSafe> RefUnwindSafe for SyncOnceCell; impl<T: UnwindSafe> UnwindSafe for SyncOnceCell; impl<T: Clone> Clone for SyncOnceCell; impl<T: PartialEq> PartialEq for SyncOnceCell; impl<T: Eq> Eq for SyncOnceCell; unsafe impl<T: Sync + Send> Sync for SyncOnceCell; unsafe impl<T: Send> Send for SyncOnceCell; impl<T: fmt::Debug> fmt::Debug for SyncOnceCell;
pub struct SyncLazy<T, F = fn() -> T>;
impl<T, F> SyncLazy<T, F> { pub const fn new(f: F) -> SyncLazy<T, F>; } impl<T, F: FnOnce() -> T> SyncLazy<T, F> { pub fn force(this: &SyncLazy<T, F>) -> &T; } impl<T, F: FnOnce() -> T> Deref for SyncLazy<T, F>; impl<T: Default> Default for SyncLazy; impl<T, F: UnwindSafe> RefUnwindSafe for SyncLazy<T, F> where SyncOnceCell: RefUnwindSafe; impl<T, F: UnwindSafe> UnwindSafe for SyncLazy<T, F> where SyncOnceCell: UnwindSafe; unsafe impl<T, F: Send> Sync for SyncLazy<T, F> where SyncOnceCell: Sync; impl<T: fmt::Debug, F> fmt::Debug for SyncLazy<T, F>;