summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 04:59:25 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 04:59:25 +0000
commitbe774f27e338799ce7272cd1bd9cad04343f12ba (patch)
tree93de04df4d8ef549e4599320762dc6deb2d924fc
parent32267ab9a6a0b87e7fea63b0e0656457b7811a14 (diff)
parentbe06080469b07fcb205eb07ac2c795821e1bfcdc (diff)
downloadoctets-android14-mainline-mediaprovider-release.tar.gz
Change-Id: Idce99a5273d80d08c54230a5b0304a7202e36456
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp8
-rw-r--r--Cargo.toml7
-rw-r--r--Cargo.toml.orig2
-rw-r--r--METADATA12
-rw-r--r--TEST_MAPPING11
-rw-r--r--src/lib.rs22
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
diff --git a/Android.bp b/Android.bp
index 6315d5d..c52e946 100644
--- a/Android.bp
+++ b/Android.bp
@@ -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,
diff --git a/Cargo.toml b/Cargo.toml
index 0202601..680f1f4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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"
diff --git a/METADATA b/METADATA
index 5b61482..e257b11 100644
--- a/METADATA
+++ b/METADATA
@@ -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"
+ }
+ ]
+}
diff --git a/src/lib.rs b/src/lib.rs
index 67d40be..4f504bf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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