File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 13
13
//!
14
14
//! // on the stack
15
15
//! let mut xs: Vec<u8, 8> = Vec::new(); // can hold up to 8 elements
16
- //! xs.push(42).unwrap() ;
16
+ //! xs.push(42)? ;
17
17
//! assert_eq!(xs.pop(), Some(42));
18
18
//!
19
19
//! // in a `static` variable
20
20
//! static mut XS: Vec<u8, 8> = Vec::new();
21
21
//!
22
22
//! let xs = unsafe { &mut XS };
23
23
//!
24
- //! xs.push(42);
24
+ //! xs.push(42)? ;
25
25
//! assert_eq!(xs.pop(), Some(42));
26
26
//!
27
27
//! // in the heap (though kind of pointless because no reallocation)
28
28
//! let mut ys: Box<Vec<u8, 8>> = Box::new(Vec::new());
29
- //! ys.push(42).unwrap() ;
29
+ //! ys.push(42)? ;
30
30
//! assert_eq!(ys.pop(), Some(42));
31
+ //! # Ok::<(), u8>(())
31
32
//! ```
32
33
//!
33
34
//! Because they have fixed capacity `heapless` data structures don't implicitly reallocate. This
You can’t perform that action at this time.
0 commit comments