/rust/registry/src/index.crates.io-1949cf8c6b5b557f/bstr-1.12.3/src/bstr.rs
Line | Count | Source |
1 | | #[cfg(feature = "alloc")] |
2 | | use alloc::boxed::Box; |
3 | | |
4 | | /// A wrapper for `&[u8]` that provides convenient string oriented trait impls. |
5 | | /// |
6 | | /// If you need ownership or a growable byte string buffer, then use |
7 | | /// [`BString`](struct.BString.html). |
8 | | /// |
9 | | /// Using a `&BStr` is just like using a `&[u8]`, since `BStr` |
10 | | /// implements `Deref` to `[u8]`. So all methods available on `[u8]` |
11 | | /// are also available on `BStr`. |
12 | | /// |
13 | | /// # Representation |
14 | | /// |
15 | | /// A `&BStr` has the same representation as a `&str`. That is, a `&BStr` is |
16 | | /// a fat pointer which consists of a pointer to some bytes and a length. |
17 | | /// |
18 | | /// # Trait implementations |
19 | | /// |
20 | | /// The `BStr` type has a number of trait implementations, and in particular, |
21 | | /// defines equality and ordinal comparisons between `&BStr`, `&str` and |
22 | | /// `&[u8]` for convenience. |
23 | | /// |
24 | | /// The `Debug` implementation for `BStr` shows its bytes as a normal string. |
25 | | /// For invalid UTF-8, hex escape sequences are used. |
26 | | /// |
27 | | /// The `Display` implementation behaves as if `BStr` were first lossily |
28 | | /// converted to a `str`. Invalid UTF-8 bytes are substituted with the Unicode |
29 | | /// replacement codepoint, which looks like this: �. |
30 | | #[repr(transparent)] |
31 | | pub struct BStr { |
32 | | pub(crate) bytes: [u8], |
33 | | } |
34 | | |
35 | | impl BStr { |
36 | | /// Directly creates a `BStr` slice from anything that can be converted |
37 | | /// to a byte slice. |
38 | | /// |
39 | | /// This is very similar to the [`B`](crate::B) function, except this |
40 | | /// returns a `&BStr` instead of a `&[u8]`. |
41 | | /// |
42 | | /// This is a cost-free conversion. |
43 | | /// |
44 | | /// # Example |
45 | | /// |
46 | | /// You can create `BStr`'s from byte arrays, byte slices or even string |
47 | | /// slices: |
48 | | /// |
49 | | /// ``` |
50 | | /// use bstr::BStr; |
51 | | /// |
52 | | /// let a = BStr::new(b"abc"); |
53 | | /// let b = BStr::new(&b"abc"[..]); |
54 | | /// let c = BStr::new("abc"); |
55 | | /// |
56 | | /// assert_eq!(a, b); |
57 | | /// assert_eq!(a, c); |
58 | | /// ``` |
59 | | #[inline] |
60 | 258M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { |
61 | 258M | BStr::from_bytes(bytes.as_ref()) |
62 | 258M | } Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 53.7k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 53.7k | BStr::from_bytes(bytes.as_ref()) | 62 | 53.7k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 7.27M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 7.27M | BStr::from_bytes(bytes.as_ref()) | 62 | 7.27M | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 139k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 139k | BStr::from_bytes(bytes.as_ref()) | 62 | 139k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<_> <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Line | Count | Source | 60 | 300k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 300k | BStr::from_bytes(bytes.as_ref()) | 62 | 300k | } |
<bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 5.57k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 5.57k | BStr::from_bytes(bytes.as_ref()) | 62 | 5.57k | } |
<bstr::bstr::BStr>::new::<str> Line | Count | Source | 60 | 10.8k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 10.8k | BStr::from_bytes(bytes.as_ref()) | 62 | 10.8k | } |
<bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Line | Count | Source | 60 | 5.59M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 5.59M | BStr::from_bytes(bytes.as_ref()) | 62 | 5.59M | } |
<bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 185M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 185M | BStr::from_bytes(bytes.as_ref()) | 62 | 185M | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> <bstr::bstr::BStr>::new::<[u8; 0]> Line | Count | Source | 60 | 2.63M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 2.63M | BStr::from_bytes(bytes.as_ref()) | 62 | 2.63M | } |
<bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Line | Count | Source | 60 | 1.31k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 1.31k | BStr::from_bytes(bytes.as_ref()) | 62 | 1.31k | } |
<bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 5.43M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 5.43M | BStr::from_bytes(bytes.as_ref()) | 62 | 5.43M | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 107k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 107k | BStr::from_bytes(bytes.as_ref()) | 62 | 107k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 18.9M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 18.9M | BStr::from_bytes(bytes.as_ref()) | 62 | 18.9M | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<_> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 804 | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 804 | BStr::from_bytes(bytes.as_ref()) | 62 | 804 | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 193 | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 193 | BStr::from_bytes(bytes.as_ref()) | 62 | 193 | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<_> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 3.96M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 3.96M | BStr::from_bytes(bytes.as_ref()) | 62 | 3.96M | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 3.54k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 3.54k | BStr::from_bytes(bytes.as_ref()) | 62 | 3.54k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 317 | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 317 | BStr::from_bytes(bytes.as_ref()) | 62 | 317 | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 508k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 508k | BStr::from_bytes(bytes.as_ref()) | 62 | 508k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 4.66k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 4.66k | BStr::from_bytes(bytes.as_ref()) | 62 | 4.66k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 4.56k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 4.56k | BStr::from_bytes(bytes.as_ref()) | 62 | 4.56k | } |
<bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Line | Count | Source | 60 | 1.48k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 1.48k | BStr::from_bytes(bytes.as_ref()) | 62 | 1.48k | } |
<bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 92.1k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 92.1k | BStr::from_bytes(bytes.as_ref()) | 62 | 92.1k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 32.0k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 32.0k | BStr::from_bytes(bytes.as_ref()) | 62 | 32.0k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 2.78M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 2.78M | BStr::from_bytes(bytes.as_ref()) | 62 | 2.78M | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 201k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 201k | BStr::from_bytes(bytes.as_ref()) | 62 | 201k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 27.4k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 27.4k | BStr::from_bytes(bytes.as_ref()) | 62 | 27.4k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 11.4k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 11.4k | BStr::from_bytes(bytes.as_ref()) | 62 | 11.4k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 137k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 137k | BStr::from_bytes(bytes.as_ref()) | 62 | 137k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Line | Count | Source | 60 | 3.19k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 3.19k | BStr::from_bytes(bytes.as_ref()) | 62 | 3.19k | } |
<bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 2.07k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 2.07k | BStr::from_bytes(bytes.as_ref()) | 62 | 2.07k | } |
<bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Line | Count | Source | 60 | 30.4k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 30.4k | BStr::from_bytes(bytes.as_ref()) | 62 | 30.4k | } |
<bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 38.0k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 38.0k | BStr::from_bytes(bytes.as_ref()) | 62 | 38.0k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 1.35k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 1.35k | BStr::from_bytes(bytes.as_ref()) | 62 | 1.35k | } |
<bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 980 | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 980 | BStr::from_bytes(bytes.as_ref()) | 62 | 980 | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 13.0M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 13.0M | BStr::from_bytes(bytes.as_ref()) | 62 | 13.0M | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Line | Count | Source | 60 | 4.07k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 4.07k | BStr::from_bytes(bytes.as_ref()) | 62 | 4.07k | } |
<bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 87.8k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 87.8k | BStr::from_bytes(bytes.as_ref()) | 62 | 87.8k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 783k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 783k | BStr::from_bytes(bytes.as_ref()) | 62 | 783k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Line | Count | Source | 60 | 4.93k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 4.93k | BStr::from_bytes(bytes.as_ref()) | 62 | 4.93k | } |
<bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 4.42M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 4.42M | BStr::from_bytes(bytes.as_ref()) | 62 | 4.42M | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Line | Count | Source | 60 | 1.38k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 1.38k | BStr::from_bytes(bytes.as_ref()) | 62 | 1.38k | } |
<bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 67.5k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 67.5k | BStr::from_bytes(bytes.as_ref()) | 62 | 67.5k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 38.0k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 38.0k | BStr::from_bytes(bytes.as_ref()) | 62 | 38.0k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Line | Count | Source | 60 | 1.79k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 1.79k | BStr::from_bytes(bytes.as_ref()) | 62 | 1.79k | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Line | Count | Source | 60 | 1.04k | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 1.04k | BStr::from_bytes(bytes.as_ref()) | 62 | 1.04k | } |
<bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 2.44M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 2.44M | BStr::from_bytes(bytes.as_ref()) | 62 | 2.44M | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> <bstr::bstr::BStr>::new::<[u8]> Line | Count | Source | 60 | 4.51M | pub fn new<B: ?Sized + AsRef<[u8]>>(bytes: &B) -> &BStr { | 61 | 4.51M | BStr::from_bytes(bytes.as_ref()) | 62 | 4.51M | } |
Unexecuted instantiation: <bstr::bstr::BStr>::new::<alloc::vec::Vec<u8>> Unexecuted instantiation: <bstr::bstr::BStr>::new::<[u8]> |
63 | | |
64 | | #[inline] |
65 | 0 | pub(crate) fn new_mut<B: ?Sized + AsMut<[u8]>>( |
66 | 0 | bytes: &mut B, |
67 | 0 | ) -> &mut BStr { |
68 | 0 | BStr::from_bytes_mut(bytes.as_mut()) |
69 | 0 | } Unexecuted instantiation: <bstr::bstr::BStr>::new_mut::<_> Unexecuted instantiation: <bstr::bstr::BStr>::new_mut::<_> Unexecuted instantiation: <bstr::bstr::BStr>::new_mut::<_> |
70 | | |
71 | | #[inline] |
72 | 289M | pub(crate) fn from_bytes(slice: &[u8]) -> &BStr { |
73 | 289M | unsafe { &*(slice as *const [u8] as *const BStr) } |
74 | 289M | } <bstr::bstr::BStr>::from_bytes Line | Count | Source | 72 | 4.44M | pub(crate) fn from_bytes(slice: &[u8]) -> &BStr { | 73 | 4.44M | unsafe { &*(slice as *const [u8] as *const BStr) } | 74 | 4.44M | } |
<bstr::bstr::BStr>::from_bytes Line | Count | Source | 72 | 24.1M | pub(crate) fn from_bytes(slice: &[u8]) -> &BStr { | 73 | 24.1M | unsafe { &*(slice as *const [u8] as *const BStr) } | 74 | 24.1M | } |
<bstr::bstr::BStr>::from_bytes Line | Count | Source | 72 | 261M | pub(crate) fn from_bytes(slice: &[u8]) -> &BStr { | 73 | 261M | unsafe { &*(slice as *const [u8] as *const BStr) } | 74 | 261M | } |
Unexecuted instantiation: <bstr::bstr::BStr>::from_bytes |
75 | | |
76 | | #[inline] |
77 | 0 | pub(crate) fn from_bytes_mut(slice: &mut [u8]) -> &mut BStr { |
78 | 0 | unsafe { &mut *(slice as *mut [u8] as *mut BStr) } |
79 | 0 | } Unexecuted instantiation: <bstr::bstr::BStr>::from_bytes_mut Unexecuted instantiation: <bstr::bstr::BStr>::from_bytes_mut Unexecuted instantiation: <bstr::bstr::BStr>::from_bytes_mut |
80 | | |
81 | | #[inline] |
82 | | #[cfg(feature = "alloc")] |
83 | 0 | pub(crate) fn from_boxed_bytes(slice: Box<[u8]>) -> Box<BStr> { |
84 | 0 | unsafe { Box::from_raw(Box::into_raw(slice) as _) } |
85 | 0 | } Unexecuted instantiation: <bstr::bstr::BStr>::from_boxed_bytes Unexecuted instantiation: <bstr::bstr::BStr>::from_boxed_bytes Unexecuted instantiation: <bstr::bstr::BStr>::from_boxed_bytes |
86 | | |
87 | | #[inline] |
88 | | #[cfg(feature = "alloc")] |
89 | 0 | pub(crate) fn into_boxed_bytes(slice: Box<BStr>) -> Box<[u8]> { |
90 | 0 | unsafe { Box::from_raw(Box::into_raw(slice) as _) } |
91 | 0 | } Unexecuted instantiation: <bstr::bstr::BStr>::into_boxed_bytes Unexecuted instantiation: <bstr::bstr::BStr>::into_boxed_bytes Unexecuted instantiation: <bstr::bstr::BStr>::into_boxed_bytes |
92 | | |
93 | | #[inline] |
94 | 83.2M | pub(crate) fn as_bytes(&self) -> &[u8] { |
95 | 83.2M | &self.bytes |
96 | 83.2M | } <bstr::bstr::BStr>::as_bytes Line | Count | Source | 94 | 8.50k | pub(crate) fn as_bytes(&self) -> &[u8] { | 95 | 8.50k | &self.bytes | 96 | 8.50k | } |
<bstr::bstr::BStr>::as_bytes Line | Count | Source | 94 | 13.1M | pub(crate) fn as_bytes(&self) -> &[u8] { | 95 | 13.1M | &self.bytes | 96 | 13.1M | } |
<bstr::bstr::BStr>::as_bytes Line | Count | Source | 94 | 70.0M | pub(crate) fn as_bytes(&self) -> &[u8] { | 95 | 70.0M | &self.bytes | 96 | 70.0M | } |
|
97 | | } |