File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 22name = " byteview"
33description = " Thin, immutable zero-copy slice type"
44license = " MIT OR Apache-2.0"
5- version = " 0.9.0 "
5+ version = " 0.9.1 "
66edition = " 2021"
77rust-version = " 1.81"
88readme = " README.md"
Original file line number Diff line number Diff line change @@ -268,7 +268,7 @@ impl ByteView {
268268 // NOTE: We can use _unzeroed to skip zeroing of the heap allocated slice
269269 // because we receive the `len` parameter
270270 // If the reader does not give us exactly `len` bytes, `read_exact` fails anyway
271- let mut s = Self :: with_size_unzeroed ( len) ;
271+ let mut s = unsafe { Self :: with_size_unzeroed ( len) } ;
272272 {
273273 let mut builder = Mutator ( & mut s) ;
274274 reader. read_exact ( & mut builder) ?;
@@ -365,7 +365,7 @@ impl ByteView {
365365 /// Panics if the length does not fit in a u32 (4 GiB).
366366 #[ doc( hidden) ]
367367 #[ must_use]
368- pub fn with_size_unzeroed ( slice_len : usize ) -> Self {
368+ pub unsafe fn with_size_unzeroed ( slice_len : usize ) -> Self {
369369 let view = if slice_len <= INLINE_SIZE {
370370 Self {
371371 trailer : Trailer {
@@ -430,7 +430,7 @@ impl ByteView {
430430 pub fn new ( slice : & [ u8 ] ) -> Self {
431431 let slice_len = slice. len ( ) ;
432432
433- let mut view = Self :: with_size_unzeroed ( slice_len) ;
433+ let mut view = unsafe { Self :: with_size_unzeroed ( slice_len) } ;
434434
435435 if view. is_inline ( ) {
436436 // SAFETY: We check for inlinability
You can’t perform that action at this time.
0 commit comments