Lines Matching defs:LazyCell

17 //! This crate provides a `LazyCell` struct which acts as a lazily filled
21 //! the entire object, but only of the borrows returned. A `LazyCell` is a
28 //! `LazyCell`.
31 //! use lazycell::LazyCell;
33 //! let lazycell = LazyCell::new();
58 /// A `LazyCell` is completely frozen once filled, **unless** you have `&mut`
59 /// access to it, in which case `LazyCell::borrow_mut` may be used to mutate the
62 pub struct LazyCell<T> {
66 impl<T> LazyCell<T> {
67 /// Creates a new, empty, `LazyCell`.
68 pub fn new() -> LazyCell<T> {
69 LazyCell { inner: UnsafeCell::new(None) }
142 /// Borrows the contents of this `LazyCell` mutably for the duration of the
198 /// Consumes this `LazyCell`, returning the underlying value.
208 impl<T: Copy> LazyCell<T> {
218 impl <T: Clone> Clone for LazyCell<T> {
219 /// Create a clone of this `LazyCell`
221 /// If self has not been initialized, returns an uninitialized `LazyCell`
222 /// otherwise returns a `LazyCell` already initialized with a clone of the
224 fn clone(&self) -> LazyCell<T> {
225 LazyCell { inner: UnsafeCell::new(self.borrow().map(Clone::clone) ) }
305 /// Consumes this `LazyCell`, returning the underlying value.
351 use super::{AtomicLazyCell, LazyCell};
355 let lazycell: LazyCell<usize> = LazyCell::new();
366 let lazycell = LazyCell::new();
381 let mut lazycell = LazyCell::new();
391 lazycell = LazyCell::new();
397 let lazycell = LazyCell::new();
405 let lazycell = LazyCell::new();
413 let lazycell = LazyCell::new();
422 let lazycell = LazyCell::new();
435 let lazycell: LazyCell<Box<i32>> = LazyCell::new();
448 let mut lazycell = LazyCell::new();
460 let mut lazycell = LazyCell::new();
469 let mut lazycell = LazyCell::new();
479 let lazycell = LazyCell::new();
486 let lazycell = LazyCell::<()>::new();
493 let lazycell = LazyCell::new();
502 let lazycell: LazyCell<Box<i32>> = LazyCell::new();
515 let mut lazycell = LazyCell::new();
526 let mut lazycell = LazyCell::<()>::new();
533 let mut lazycell = LazyCell::new();
541 let lazycell = LazyCell::new();
593 let mut cell = LazyCell::new();
599 let mut cell = LazyCell::new();
614 let mut cell = LazyCell::new();