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 1313//!
1414//! // on the stack
1515//! let mut xs: Vec<u8, 8> = Vec::new(); // can hold up to 8 elements
16- //! xs.push(42).unwrap() ;
16+ //! xs.push(42)? ;
1717//! assert_eq!(xs.pop(), Some(42));
1818//!
1919//! // in a `static` variable
2020//! static mut XS: Vec<u8, 8> = Vec::new();
2121//!
2222//! let xs = unsafe { &mut XS };
2323//!
24- //! xs.push(42);
24+ //! xs.push(42)? ;
2525//! assert_eq!(xs.pop(), Some(42));
2626//!
2727//! // in the heap (though kind of pointless because no reallocation)
2828//! let mut ys: Box<Vec<u8, 8>> = Box::new(Vec::new());
29- //! ys.push(42).unwrap() ;
29+ //! ys.push(42)? ;
3030//! assert_eq!(ys.pop(), Some(42));
31+ //! # Ok::<(), u8>(())
3132//! ```
3233//!
3334//! 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