Lines Matching refs:bytes
295 // Short strings: 65 bytes each
398 b.bytes = REPETITIONS;
409 b.bytes = REPETITIONS;
420 b.bytes = REPETITIONS * 2;
551 b.bytes = src_len as u64;
577 b.bytes = src_len as u64;
603 b.bytes = src_len as u64;
631 b.bytes = src_len as u64;
659 b.bytes = src_len as u64;
691 b.bytes = src_len as u64;
739 b.bytes = src_len as u64;
800 b.bytes = src_len as u64;
829 b.bytes = (times * src_len) as u64;
1059 b.bytes = 800; // 2 casts x 4 bytes x 100
1210 b.bytes = std::mem::size_of_val(template.as_slice()) as u64;
1229 b.bytes = std::mem::size_of_val(template.as_slice()) as u64;
2270 b.bytes = $len * mem::size_of_val(&$gen(1)[0]) as u64;
2282 b.bytes = $len * mem::size_of::<&str>() as u64;
2304 b.bytes = $len * mem::size_of_val(&$gen(1)[0]) as u64;
2315 b.bytes = $len * mem::size_of_val(&$gen(1)[0]) as u64;
2360 b.bytes = n;
2385 b.bytes = (v.len() * size) as u64;
3643 // join has fast paths for small separators up to 4 bytes
4151 "byte index 4 is not a char boundary; it is inside 'α' (bytes 3..5) of";
4158 "byte index 6 is not a char boundary; it is inside 'β' (bytes 5..7) of";
4165 "byte index 4 is not a char boundary; it is inside 'α' (bytes 3..5) of";
4172 "byte index 6 is not a char boundary; it is inside 'β' (bytes 5..7) of";
4179 "byte index 4 is not a char boundary; it is inside 'α' (bytes 3..5) of";
4186 "byte index 6 is not a char boundary; it is inside 'β' (bytes 5..7) of";
4193 "byte index 6 is not a char boundary; it is inside 'β' (bytes 5..7) of";
4257 // ensure character locations are boundaries and continuation bytes are not
4381 // deny invalid bytes embedded in long stretches of ascii
4624 let mut bytes = [0; 4];
4626 let s = c.encode_utf8(&mut bytes);
4636 let mut bytes = [0; 4];
4638 let s = c.encode_utf8(&mut bytes);
4680 for b in s.bytes() {
4695 for b in s.bytes().rev() {
4709 let mut b = s.bytes();
4719 let b = s.bytes();
4727 let b = s.bytes();
5552 for ab in a.bytes() {
5570 // Chars of 1, 2, 3, and 4 bytes
5866 assert_eq!(data.pop().unwrap(), '?'); // 4 bytes
5867 assert_eq!(data.pop().unwrap(), '€'); // 3 bytes
5868 assert_eq!(data.pop().unwrap(), '¢'); // 2 bytes
5869 assert_eq!(data.pop().unwrap(), 'b'); // 1 bytes
6304 // * overflow may trigger when multiplying `new_cap` by size_of::<T> (to get bytes)
7983 // * overflow may trigger when multiplying `new_cap` by size_of::<T> (to get bytes)
12362 // * overflow may trigger when multiplying `new_cap` by size_of::<T> (to get bytes)
14208 // bytes. Also, because the old allocation wasn't yet deallocated, it cannot overlap
14296 // bytes. Also, because the old allocation wasn't yet deallocated, it cannot overlap
14386 panic!("memory allocation of {} bytes failed", size)
14457 /// * Guards against 32-bit systems allocating more than isize::MAX bytes.
14502 /// Panics if the requested capacity exceeds `isize::MAX` bytes.
14535 // to round up a request of less than 8 bytes to at least 8 bytes.
14698 /// Panics if the new capacity exceeds `isize::MAX` bytes.
14775 /// Panics if the new capacity exceeds `isize::MAX` bytes.
14951 // `> isize::MAX` bytes will surely fail. On 32-bit and 16-bit we need to add
15095 ($target:expr, $bytes:expr) => {
15096 let len = $bytes.len();
15098 head.copy_from_slice($bytes);
15154 // Make sure we don't expose uninitialized bytes to the caller.
15497 let mut bytes = self.as_bytes().to_vec();
15498 bytes.make_ascii_uppercase();
15500 unsafe { String::from_utf8_unchecked(bytes) }
15527 let mut bytes = self.as_bytes().to_vec();
15528 bytes.make_ascii_lowercase();
15530 unsafe { String::from_utf8_unchecked(bytes) }
15534 /// Converts a boxed slice of bytes to a boxed string slice without checking
16198 //! If you have a vector of valid UTF-8 bytes, you can make a [`String`] out of
16204 //! // We know these bytes are valid, so we'll use `unwrap()`.
16209 //! let bytes = sparkle_heart.into_bytes();
16211 //! assert_eq!(bytes, [240, 159, 146, 150]);
16261 /// If you have a vector of UTF-8 bytes, you can create a `String` from it with
16265 /// // some bytes, in a vector
16268 /// // We know these bytes are valid, so we'll use `unwrap()`.
16294 /// The [`bytes`] and [`chars`] methods return iterators over the first
16297 /// [`bytes`]: str::bytes
16349 /// A `String` is made up of three components: a pointer to some bytes, a
16351 /// uses to store its data. The length is the number of bytes currently stored
16352 /// in the buffer, and the capacity is the size of the buffer in bytes. As such,
16373 /// // story has nineteen bytes
16479 /// // some invalid bytes, in a vector
16480 /// let bytes = vec![0, 159];
16482 /// let value = String::from_utf8(bytes);
16490 bytes: Vec<u8>,
16545 /// buffer that can hold `capacity` bytes. This is useful when you may be
16595 /// Converts a vector of bytes to a `String`.
16597 /// A string ([`String`]) is made of bytes ([`u8`]), and a vector of bytes
16598 /// ([`Vec<u8>`]) is made of bytes, so this function converts between the
16601 /// the bytes are valid UTF-8, and then does the conversion.
16619 /// provided bytes are not UTF-8. The vector you moved in is also included.
16626 /// // some bytes, in a vector
16629 /// // We know these bytes are valid, so we'll use `unwrap()`.
16635 /// Incorrect bytes:
16638 /// // some invalid bytes, in a vector
16656 Err(e) => Err(FromUtf8Error { bytes: vec, error: e }),
16660 /// Converts a slice of bytes to a string, including invalid characters.
16662 /// Strings are made of bytes ([`u8`]), and a slice of bytes
16663 /// ([`&[u8]`][byteslice]) is made of bytes, so this function converts
16692 /// // some bytes, in a vector
16700 /// Incorrect bytes:
16703 /// // some invalid bytes
16809 /// the string (in bytes), and the allocated capacity of the data
16810 /// (in bytes). These are the same arguments in the same order as
16848 /// * The first `length` bytes at `buf` need to be valid UTF-8.
16888 /// Converts a vector of bytes to a `String` without checking that the
16897 /// This function is unsafe because it does not check that the bytes passed
16907 /// // some bytes, in a vector
16918 pub unsafe fn from_utf8_unchecked(bytes: Vec<u8>) -> String {
16919 String { vec: bytes }
16932 /// let bytes = s.into_bytes();
16934 /// assert_eq!(&[104, 101, 108, 108, 111][..], &bytes[..]);
16998 /// Returns this `String`'s capacity, in bytes.
17015 /// Ensures that this `String`'s capacity is at least `additional` bytes
17018 /// The capacity may be increased by more than `additional` bytes if it
17065 /// Ensures that this `String`'s capacity is `additional` bytes
17140 /// # process_data("rust").expect("why is the test harness OOMing on 4 bytes?");
17178 /// # process_data("rust").expect("why is the test harness OOMing on 4 bytes?");
17538 unsafe fn insert_bytes(&mut self, idx: usize, bytes: &[u8]) {
17540 let amt = bytes.len();
17545 ptr::copy(bytes.as_ptr(), self.vec.as_mut_ptr().add(idx), amt);
17585 /// This function is unsafe because it does not check that the bytes passed
17611 /// Returns the length of this `String`, in bytes, not [`char`]s or
17655 /// Returns a newly allocated `String`. `self` contains bytes `[0, at)`, and
17656 /// the returned `String` contains bytes `[at, len)`. `at` must be on the
17745 // of the vector version. The data is just plain bytes.
17790 // of the vector version. The data is just plain bytes.
17810 unsafe { self.as_mut_vec() }.splice((start, end), replace_with.bytes());
17837 /// Returns a slice of [`u8`]s bytes that were attempted to convert to a `String`.
17844 /// // some invalid bytes, in a vector
17845 /// let bytes = vec![0, 159];
17847 /// let value = String::from_utf8(bytes);
17853 &self.bytes[..]
17856 /// Returns the bytes that were attempted to convert to a `String`.
17859 /// consume the error, moving out the bytes, so that a copy of the bytes
17867 /// // some invalid bytes, in a vector
17868 /// let bytes = vec![0, 159];
17870 /// let value = String::from_utf8(bytes);
17876 self.bytes
17894 /// // some invalid bytes, in a vector
17895 /// let bytes = vec![0, 159];
17897 /// let error = String::from_utf8(bytes).unwrap_err().utf8_error();
19944 /// being filled with `0` bytes.
20032 /// being filled with `0` bytes, returning an error if the allocation fails
20141 /// filled with `0` bytes.
20762 // Copy value as bytes
23716 /// being filled with `0` bytes.
23813 /// being filled with `0` bytes, returning an error if allocation fails.
23914 /// filled with `0` bytes.
24412 // Copy value as bytes
39953 /// (usually `isize::MAX` bytes).
41037 /// # process_data(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");
41075 /// # process_data(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");
44092 fn write(&mut self, bytes: &[u8]) {
44093 // This particular implementation hashes value 24 in addition to bytes.
44096 for &v in iter::once(&24).chain(bytes) {
46548 // For fat pointers, the bytes that would be the pointer metadata in the `Some`
46815 //! Vectors ensure they never allocate more than `isize::MAX` bytes.
47223 /// Panics if the new capacity exceeds `isize::MAX` bytes.
47358 /// Panics if the new capacity exceeds `isize::MAX` bytes.
47576 /// Panics if the new capacity exceeds `isize::MAX` bytes.
47647 /// # process_data(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");
47689 /// # process_data(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");
48002 /// // Per the FFI method's docs, "32768 bytes is always enough".
48429 /// Panics if the new capacity exceeds `isize::MAX` bytes.
48441 // This will panic or abort if we would allocate > isize::MAX bytes
50176 //! never allocate more than `isize::MAX` bytes.
50383 /// being filled with `0` bytes.
50462 /// being filled with `0` bytes on the heap
50600 /// being filled with `0` bytes in the provided allocator.
50632 /// being filled with `0` bytes in the provided allocator,
50726 /// being filled with `0` bytes.
50779 /// with the memory being filled with `0` bytes.
51314 fn write(&mut self, bytes: &[u8]) {
51315 (**self).write(bytes)