defmt/impls/core_/
cell.rs

1use super::*;
2
3impl<T> Format for core::cell::Cell<T>
4where
5    T: Format + Copy,
6{
7    fn format(&self, fmt: Formatter) {
8        crate::write!(fmt, "Cell {{ value: {=?} }})", self.get())
9    }
10}
11
12impl<T> Format for core::cell::RefCell<T>
13where
14    T: Format,
15{
16    default_format!();
17
18    #[inline]
19    fn _format_tag() -> Str {
20        internp!("RefCell {{ value: <borrowed> }}|RefCell {{ value: {=?} }}")
21    }
22
23    #[inline]
24    fn _format_data(&self) {
25        match self.try_borrow() {
26            Err(_) => export::u8(&0),
27            Ok(x) => {
28                export::u8(&1);
29                export::istr(&T::_format_tag());
30                x._format_data()
31            }
32        }
33    }
34}
35
36impl Format for core::cell::BorrowError {
37    fn format(&self, fmt: Formatter) {
38        crate::write!(fmt, "BorrowError")
39    }
40}
41
42impl Format for core::cell::BorrowMutError {
43    fn format(&self, fmt: Formatter) {
44        crate::write!(fmt, "BorrowMutError")
45    }
46}