Lines Matching defs:set
10 //! fn set(&self, value: T) -> Result<(), T> { ... }
15 //! Note that, like with [`RefCell`] and [`Mutex`], the `set` method requires only a shared reference.
57 //! INSTANCE.set(logger).unwrap();
215 //! assert!(self.cell.set(value).is_ok())
473 /// cell.set(92).unwrap();
495 /// assert_eq!(cell.set(92), Ok(()));
496 /// assert_eq!(cell.set(62), Err(62));
500 pub fn set(&self, value: T) -> Result<(), T> {
507 /// Like [`set`](Self::set), but also returns a reference to the final cell value.
527 // This is the only place where we set the slot, no races
602 // `assert`, while keeping `set/get` would be sound, but it seems
604 assert!(self.set(val).is_ok(), "reentrant init");
621 /// cell.set("hello".to_string()).unwrap();
634 /// cell.set(92).unwrap();
654 /// cell.set("hello".to_string()).unwrap();
938 /// thread until it is set.
946 /// move || cell.set(92).unwrap()
952 /// // Will return 92, but might block until the other thread does `.set`.
980 /// cell.set(92).unwrap();
1016 /// assert_eq!(CELL.set(92), Ok(()));
1019 /// assert_eq!(CELL.set(62), Err(62));
1023 pub fn set(&self, value: T) -> Result<(), T> {
1030 /// Like [`set`](Self::set), but also returns a reference to the final cell value.
1146 /// cell.set("hello".to_string()).unwrap();
1159 /// cell.set(92).unwrap();
1178 /// cell.set("hello".to_string()).unwrap();