diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 04:56:07 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 04:56:07 +0000 |
commit | f3ba372760776285dbfdc79a7456bd90ba8d243c (patch) | |
tree | 93de04df4d8ef549e4599320762dc6deb2d924fc | |
parent | 02a335a3e89e69de4d142c506f7d99eb0546d3f1 (diff) | |
parent | be06080469b07fcb205eb07ac2c795821e1bfcdc (diff) | |
download | octets-f3ba372760776285dbfdc79a7456bd90ba8d243c.tar.gz |
Snap for 10453563 from be06080469b07fcb205eb07ac2c795821e1bfcdc to mainline-media-swcodec-releaseaml_swc_341711000aml_swc_341619000aml_swc_341513600aml_swc_341312300aml_swc_341312020aml_swc_341111000aml_swc_341011020aml_swc_340922010android14-mainline-media-swcodec-release
Change-Id: Ie9009a9f0e4758471e05884a962dad45f163806d
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 8 | ||||
-rw-r--r-- | Cargo.toml | 7 | ||||
-rw-r--r-- | Cargo.toml.orig | 2 | ||||
-rw-r--r-- | METADATA | 12 | ||||
-rw-r--r-- | TEST_MAPPING | 11 | ||||
-rw-r--r-- | src/lib.rs | 22 |
7 files changed, 46 insertions, 18 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 7eb1d2d..9787b6f 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,6 @@ { "git": { - "sha1": "1c612215d636616e8ea07f640f3829c7f1b39000" + "sha1": "4bda0917dd5aa535f39214063ee85c2cad00ceb2" }, "path_in_vcs": "octets" }
\ No newline at end of file @@ -1,8 +1,6 @@ // This file is generated by cargo2android.py --config cargo2android.json. // Do not modify this file as changes will be overridden on upgrade. - - package { default_applicable_licenses: ["external_rust_crates_octets_license"], } @@ -25,13 +23,15 @@ rust_library { host_supported: true, crate_name: "octets", cargo_env_compat: true, - cargo_pkg_version: "0.1.0", + cargo_pkg_version: "0.2.0", srcs: ["src/lib.rs"], edition: "2018", apex_available: [ "//apex_available:platform", "com.android.resolv", ], + product_available: true, + vendor_available: true, min_sdk_version: "29", } @@ -40,7 +40,7 @@ rust_test { host_supported: true, crate_name: "octets", cargo_env_compat: true, - cargo_pkg_version: "0.1.0", + cargo_pkg_version: "0.2.0", srcs: ["src/lib.rs"], test_suites: ["general-tests"], auto_gen_config: true, @@ -12,10 +12,13 @@ [package] edition = "2018" name = "octets" -version = "0.1.0" +version = "0.2.0" authors = ["Alessandro Ghedini <alessandro@ghedini.me>"] description = "Zero-copy abstraction for parsing and constructing network packets" -keywords = ["quic", "http3"] +keywords = [ + "quic", + "http3", +] categories = ["network-programming"] license = "BSD-2-Clause" repository = "https://github.com/cloudflare/quiche" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 21f589f..ebddee4 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "octets" -version = "0.1.0" +version = "0.2.0" authors = ["Alessandro Ghedini <alessandro@ghedini.me>"] edition = "2018" description = "Zero-copy abstraction for parsing and constructing network packets" @@ -1,3 +1,7 @@ +# This project was upgraded with external_updater. +# Usage: tools/external_updater/updater.sh update rust/crates/octets +# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md + name: "octets" description: "Zero-copy abstraction for parsing and constructing network packets" third_party { @@ -7,13 +11,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/octets/octets-0.1.0.crate" + value: "https://static.crates.io/crates/octets/octets-0.2.0.crate" } - version: "0.1.0" + version: "0.2.0" license_type: NOTICE last_upgrade_date { year: 2022 - month: 9 - day: 20 + month: 12 + day: 13 } } diff --git a/TEST_MAPPING b/TEST_MAPPING new file mode 100644 index 0000000..cd576aa --- /dev/null +++ b/TEST_MAPPING @@ -0,0 +1,11 @@ +// Generated by update_crate_tests.py for tests that depend on this crate. +{ + "imports": [ + { + "path": "external/rust/crates/quiche" + }, + { + "path": "packages/modules/DnsResolver" + } + ] +} @@ -197,7 +197,7 @@ impl<'a> Octets<'a> { /// Reads `len` bytes from the current offset without copying and advances /// the buffer. - pub fn get_bytes(&mut self, len: usize) -> Result<Octets> { + pub fn get_bytes(&mut self, len: usize) -> Result<Octets<'a>> { if self.cap() < len { return Err(BufferTooShortError); } @@ -214,7 +214,7 @@ impl<'a> Octets<'a> { /// Reads `len` bytes from the current offset without copying and advances /// the buffer, where `len` is an unsigned 8-bit integer prefix. - pub fn get_bytes_with_u8_length(&mut self) -> Result<Octets> { + pub fn get_bytes_with_u8_length(&mut self) -> Result<Octets<'a>> { let len = self.get_u8()?; self.get_bytes(len as usize) } @@ -222,7 +222,7 @@ impl<'a> Octets<'a> { /// Reads `len` bytes from the current offset without copying and advances /// the buffer, where `len` is an unsigned 16-bit integer prefix in network /// byte-order. - pub fn get_bytes_with_u16_length(&mut self) -> Result<Octets> { + pub fn get_bytes_with_u16_length(&mut self) -> Result<Octets<'a>> { let len = self.get_u16()?; self.get_bytes(len as usize) } @@ -230,14 +230,14 @@ impl<'a> Octets<'a> { /// Reads `len` bytes from the current offset without copying and advances /// the buffer, where `len` is an unsigned variable-length integer prefix /// in network byte-order. - pub fn get_bytes_with_varint_length(&mut self) -> Result<Octets> { + pub fn get_bytes_with_varint_length(&mut self) -> Result<Octets<'a>> { let len = self.get_varint()?; self.get_bytes(len as usize) } /// Reads `len` bytes from the current offset without copying and without /// advancing the buffer. - pub fn peek_bytes(&self, len: usize) -> Result<Octets> { + pub fn peek_bytes(&self, len: usize) -> Result<Octets<'a>> { if self.cap() < len { return Err(BufferTooShortError); } @@ -290,13 +290,18 @@ impl<'a> Octets<'a> { self.buf.len() } + /// Returns `true` if the buffer is empty. + pub fn is_empty(&self) -> bool { + self.buf.len() == 0 + } + /// Returns the current offset of the buffer. pub fn off(&self) -> usize { self.off } /// Returns a reference to the internal buffer. - pub fn buf(&self) -> &[u8] { + pub fn buf(&self) -> &'a [u8] { self.buf } @@ -626,6 +631,11 @@ impl<'a> OctetsMut<'a> { self.buf.len() } + /// Returns `true` if the buffer is empty. + pub fn is_empty(&self) -> bool { + self.buf.len() == 0 + } + /// Returns the current offset of the buffer. pub fn off(&self) -> usize { self.off |