Lines Matching +full:test +full:- +full:docs

1 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
5 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
6 // <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
7 // license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
45 /// or on their super-traits. This does *not* need to hold if the two calls are
95 /// - `b.split_at(split)`
96 /// - `b.split_at_unchecked(split)`
99 /// - `first`'s address is `addr` and its length is `split`
100 /// - `second`'s address is `addr + split` and its length is `len - split`
112 fn split_at(self, mid: usize) -> Result<(Self, Self), Self> { in split_at()
141 unsafe fn split_at_unchecked(self, mid: usize) -> (Self, Self); in split_at_unchecked()
153 /// ownership, and so they cannot soundly be moved by-value into a byte slice
169 /// sense described in the `ByteSlice` docs.
170 fn into_byte_slice(self) -> &'a [u8]; in into_byte_slice()
178 /// convey ownership, and so they cannot soundly be moved by-value into a byte
194 /// sense described in the `ByteSlice` docs.
195 fn into_byte_slice_mut(self) -> &'a mut [u8]; in into_byte_slice_mut()
214 unsafe fn split_at_unchecked(self, mid: usize) -> (Self, Self) { in split_at_unchecked()
227 fn into_byte_slice(self) -> &'a [u8] { in into_byte_slice()
229 // &[u8]>::deref` as anything other than `fn deref(&self) -> &[u8] { in into_byte_slice()
245 unsafe fn split_at_unchecked(self, mid: usize) -> (Self, Self) { in split_at_unchecked()
248 // `l_ptr` is non-null, because `self` is non-null, by invariant on in split_at_unchecked()
267 // - The data `l_ptr` and `r_ptr` are valid for both reads and writes of in split_at_unchecked()
270 // - The entire memory range of each slice is contained within a in split_at_unchecked()
273 // - Both `l_ptr` and `r_ptr` are non-null and trivially aligned. in split_at_unchecked()
274 // `self` is non-null by invariant on `&mut [u8]`, and the in split_at_unchecked()
277 // - The data `l_ptr` and `r_ptr` point to `l_len` and `r_len`, in split_at_unchecked()
280 // true for these two sub-slices of `self`. in split_at_unchecked()
281 // - The memory referenced by the returned slice cannot be accessed in split_at_unchecked()
284 // - `split_at_unchecked` consumes `self` (which is not `Copy`), in split_at_unchecked()
285 // - `split_at_unchecked` does not exfiltrate any references to this in split_at_unchecked()
287 // - the returned slices are non-overlapping. in split_at_unchecked()
288 // - The individual sizes of the sub-slices of `self` are no larger than in split_at_unchecked()
292 // [1] https://doc.rust-lang.org/std/slice/fn.from_raw_parts_mut.html#safety in split_at_unchecked()
303 fn into_byte_slice(self) -> &'a [u8] { in into_byte_slice()
305 // [u8]>::deref` as anything other than `fn deref(&self) -> &[u8] { in into_byte_slice()
315 fn into_byte_slice_mut(self) -> &'a mut [u8] { in into_byte_slice_mut()
317 // [u8]>::deref` as anything other than `fn deref_mut(&mut self) -> &mut in into_byte_slice_mut()
334 unsafe fn split_at_unchecked(self, mid: usize) -> (Self, Self) { in split_at_unchecked()
354 unsafe fn split_at_unchecked(self, mid: usize) -> (Self, Self) { in split_at_unchecked()
368 fn any_vec() -> Vec<u8> { in any_vec()
407 #[cfg(test)]
413 #[test]
424 #[test]