Snap for 10447354 from be06080469b07fcb205eb07ac2c795821e1bfcdc to mainline-wifi-release

Change-Id: I3a5df0751347733d910ff0df1521806f65f3cd5d
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 @@
     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 @@
     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 @@
   }
   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 @@
 
     /// 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 @@
 
     /// 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 @@
     /// 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 @@
     /// 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 @@
         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 @@
         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