File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change
1
+ //! A fixed-capacity octets sequence.
1
2
2
3
use core:: { cmp, fmt} ;
3
4
use core:: ops:: RangeBounds ;
@@ -31,6 +32,22 @@ impl<const N: usize> Array<N> {
31
32
pub fn as_slice_mut ( & mut self ) -> & mut [ u8 ] {
32
33
& mut self . octets [ ..self . len ]
33
34
}
35
+
36
+ /// Resizes the array in place updating additional octets.
37
+ ///
38
+ /// The method only changes the length of the contained octets
39
+ /// sequence. If `new_len` is greater than the current length, the
40
+ /// content of the additional octets will be left at whatever they
41
+ /// were.
42
+ ///
43
+ /// # Panics
44
+ ///
45
+ /// The method panics if `new_len` is larger than the array size
46
+ /// `const N`.
47
+ pub fn resize_raw ( & mut self , new_len : usize ) {
48
+ assert ! ( new_len < N ) ;
49
+ self . len = new_len
50
+ }
34
51
}
35
52
36
53
You can’t perform that action at this time.
0 commit comments