aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2023-02-15 19:23:37 +0100
committerJeff Vander Stoep <jeffv@google.com>2023-02-15 19:23:37 +0100
commit0808c905b680e04611e2708c4a0ca666a61bbb26 (patch)
treea97c9c19c47ebfd320206db7eca205ea4304c69e
parentf49fc6f5429635a2c9fc6e7e104f0ff9dad157d2 (diff)
downloadbstr-0808c905b680e04611e2708c4a0ca666a61bbb26.tar.gz
Upgrade bstr to 1.2.0
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update rust/crates/bstr For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md Test: TreeHugger Change-Id: I9fea990fca3c41f62b5658b1d9918ca71486fd79
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp2
-rw-r--r--Cargo.toml2
-rw-r--r--Cargo.toml.orig2
-rw-r--r--METADATA6
-rw-r--r--src/ext_slice.rs12
-rw-r--r--src/ext_vec.rs10
-rw-r--r--src/impls.rs8
8 files changed, 30 insertions, 14 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 78c885d..117fa04 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
{
"git": {
- "sha1": "86947727666d7b21c97eb16145b3ad6ac22aacd3"
+ "sha1": "65993b58be1547bfc0de9ad8c1c8f3d3fcb0a32f"
},
"path_in_vcs": ""
} \ No newline at end of file
diff --git a/Android.bp b/Android.bp
index 9e13a61..567b12b 100644
--- a/Android.bp
+++ b/Android.bp
@@ -44,7 +44,7 @@ rust_library {
host_supported: true,
crate_name: "bstr",
cargo_env_compat: true,
- cargo_pkg_version: "1.1.0",
+ cargo_pkg_version: "1.2.0",
srcs: ["src/lib.rs"],
edition: "2021",
features: [
diff --git a/Cargo.toml b/Cargo.toml
index c4b9c4d..b74217b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
edition = "2021"
rust-version = "1.60"
name = "bstr"
-version = "1.1.0"
+version = "1.2.0"
authors = ["Andrew Gallant <jamslam@gmail.com>"]
exclude = ["/.github"]
description = "A string type that is not required to be valid UTF-8."
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index b08cd68..bdfa0b7 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "bstr"
-version = "1.1.0" #:version
+version = "1.2.0" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "A string type that is not required to be valid UTF-8."
documentation = "https://docs.rs/bstr"
diff --git a/METADATA b/METADATA
index b1f7b25..c21ad25 100644
--- a/METADATA
+++ b/METADATA
@@ -11,13 +11,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/bstr/bstr-1.1.0.crate"
+ value: "https://static.crates.io/crates/bstr/bstr-1.2.0.crate"
}
- version: "1.1.0"
+ version: "1.2.0"
license_type: NOTICE
last_upgrade_date {
year: 2023
month: 2
- day: 1
+ day: 15
}
}
diff --git a/src/ext_slice.rs b/src/ext_slice.rs
index 70f94e2..91af450 100644
--- a/src/ext_slice.rs
+++ b/src/ext_slice.rs
@@ -101,12 +101,16 @@ impl<const N: usize> ByteSlice for [u8; N] {
/// Ensure that callers cannot implement `ByteSlice` by making an
/// umplementable trait its super trait.
-pub trait Sealed {}
-impl Sealed for [u8] {}
-impl<const N: usize> Sealed for [u8; N] {}
+mod private {
+ pub trait Sealed {}
+}
+impl private::Sealed for [u8] {}
+impl<const N: usize> private::Sealed for [u8; N] {}
/// A trait that extends `&[u8]` with string oriented methods.
-pub trait ByteSlice: Sealed {
+///
+/// This trait is sealed and cannot be implemented outside of `bstr`.
+pub trait ByteSlice: private::Sealed {
/// A method for accessing the raw bytes of this type. This is always a
/// no-op and callers shouldn't care about it. This only exists for making
/// the extension trait work.
diff --git a/src/ext_vec.rs b/src/ext_vec.rs
index 5effdd0..b8e2be2 100644
--- a/src/ext_vec.rs
+++ b/src/ext_vec.rs
@@ -104,8 +104,10 @@ impl ByteVec for Vec<u8> {
/// Ensure that callers cannot implement `ByteSlice` by making an
/// umplementable trait its super trait.
-pub trait Sealed {}
-impl Sealed for Vec<u8> {}
+mod private {
+ pub trait Sealed {}
+}
+impl private::Sealed for Vec<u8> {}
/// A trait that extends `Vec<u8>` with string oriented methods.
///
@@ -119,7 +121,9 @@ impl Sealed for Vec<u8> {}
/// let s = Vec::from_slice(b"abc"); // NOT ByteVec::from_slice("...")
/// assert_eq!(s, B("abc"));
/// ```
-pub trait ByteVec: Sealed {
+///
+/// This trait is sealed and cannot be implemented outside of `bstr`.
+pub trait ByteVec: private::Sealed {
/// A method for accessing the raw vector bytes of this type. This is
/// always a no-op and callers shouldn't care about it. This only exists
/// for making the extension trait work.
diff --git a/src/impls.rs b/src/impls.rs
index eac4700..7ae4510 100644
--- a/src/impls.rs
+++ b/src/impls.rs
@@ -667,6 +667,14 @@ mod bstr {
}
}
+ #[cfg(feature = "alloc")]
+ impl Clone for Box<BStr> {
+ #[inline]
+ fn clone(&self) -> Self {
+ BStr::from_boxed_bytes(self.as_bytes().into())
+ }
+ }
+
impl Eq for BStr {}
impl PartialEq<BStr> for BStr {