Upgrade rust/crates/serde_cbor to 0.11.2 am: 257082937a am: 09d1d83d03 am: 0b0733c947 am: f6c300a543 am: 150808516e

Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/serde_cbor/+/1833618

Change-Id: Icfa82e6ba713523538d77b4e04cf9bb8d79e85d6
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index efb3a6e..6009691 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
 {
   "git": {
-    "sha1": "eddd181447c25722fa294dc2c1be8c1881b105eb"
+    "sha1": "347a3f096d5a1e8e380b9968e74838c9037a5b14"
   }
 }
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..5122b87
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,5 @@
+# see https://editorconfig.org for more options, and setup instructions for yours editor
+
+[*.rs]
+indent_style = space
+indent_size = 4
diff --git a/Android.bp b/Android.bp
index de077fe..3f2d03c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,4 @@
-// This file is generated by cargo2android.py --run --device --dependencies --tests --features default,tags.
+// This file is generated by cargo2android.py --run --device --tests --features default,tags.
 // Do not modify this file as changes will be overridden on upgrade.
 
 package {
@@ -42,7 +42,7 @@
     host_supported: true,
     crate_name: "serde_cbor",
     cargo_env_compat: true,
-    cargo_pkg_version: "0.11.1",
+    cargo_pkg_version: "0.11.2",
     srcs: ["src/lib.rs"],
     edition: "2018",
     features: [
@@ -61,7 +61,7 @@
     crate_name: "serde_cbor",
     srcs: ["src/lib.rs"],
     cargo_env_compat: true,
-    cargo_pkg_version: "0.11.1",
+    cargo_pkg_version: "0.11.2",
     test_suites: ["general-tests"],
     auto_gen_config: true,
     edition: "2018",
@@ -94,7 +94,7 @@
     name: "serde_cbor_test_defaults_serde_cbor",
     crate_name: "serde_cbor",
     cargo_env_compat: true,
-    cargo_pkg_version: "0.11.1",
+    cargo_pkg_version: "0.11.2",
     test_suites: ["general-tests"],
     auto_gen_config: true,
     edition: "2018",
diff --git a/Cargo.toml b/Cargo.toml
index 3aa5f57..2960dbe 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,8 +13,8 @@
 [package]
 edition = "2018"
 name = "serde_cbor"
-version = "0.11.1"
-authors = ["Pyfisch <pyfisch@gmail.com>", "Steven Fackler <sfackler@gmail.com>"]
+version = "0.11.2"
+authors = ["Pyfisch <pyfisch@posteo.org>", "Steven Fackler <sfackler@gmail.com>"]
 description = "CBOR support for serde."
 readme = "README.md"
 keywords = ["serde", "cbor", "serialization", "no_std"]
@@ -38,7 +38,7 @@
 tags = []
 unsealed_read_write = []
 [badges.maintenance]
-status = "passively-maintained"
+status = "as-is"
 
 [badges.travis-ci]
 repository = "pyfisch/cbor"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 8b5c14c..52e1657 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,8 +1,8 @@
 [package]
 name = "serde_cbor"
-version = "0.11.1"
+version = "0.11.2"
 authors = [
-    "Pyfisch <pyfisch@gmail.com>",
+    "Pyfisch <pyfisch@posteo.org>",
     "Steven Fackler <sfackler@gmail.com>"]
 repository = "https://github.com/pyfisch/cbor"
 readme = "README.md"
@@ -14,7 +14,7 @@
 
 [badges]
 travis-ci = { repository = "pyfisch/cbor" }
-maintenance = { status = "passively-maintained" }
+maintenance = { status = "as-is" }
 
 [dependencies]
 half = "1.2.0"
diff --git a/METADATA b/METADATA
index 4a76e30..6997441 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/serde_cbor/serde_cbor-0.11.1.crate"
+    value: "https://static.crates.io/crates/serde_cbor/serde_cbor-0.11.2.crate"
   }
-  version: "0.11.1"
+  version: "0.11.2"
   license_type: NOTICE
   last_upgrade_date {
-    year: 2020
-    month: 12
-    day: 21
+    year: 2021
+    month: 9
+    day: 22
   }
 }
diff --git a/README.md b/README.md
index 5624691..b49e8ad 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,24 @@
 [![Crates.io](https://img.shields.io/crates/v/serde_cbor.svg)](https://crates.io/crates/serde_cbor)
 [![Documentation](https://docs.rs/serde_cbor/badge.svg)](https://docs.rs/serde_cbor)
 
+## PROJECT IS ARCHIVED
+
+After almost 6 years it is time to retire this crate.
+This implementation of CBOR for serde is used in hundreds of projects with widely differing needs.
+Besides the standard features it contains code for no-std environments, a packed encoding and CBOR tags.
+However while these features are useful to many people they sometimes interact poorly with each others and with optional features of serde itself.
+Because I don't use the crate myself and because of the potential for new errors I have been reluctant to accept any changes or additional features for the crate.
+Since this situation is unlikely to change anytime soon and no one else stepped up to maintain this crate I am archiving the repository today.
+If the crate works for you there is no need to switch to another implementation.
+However if you encounter problems or for new projects I recommend you take a look at these crates:
+
+* [ciborium](https://crates.io/crates/ciborium)
+* [minicbor](https://crates.io/crates/minicbor)
+
+~~ Pyfisch, August 2021
+
+
+
 This crate implements the Concise Binary Object Representation from [RFC 7049].
 It builds on [Serde], the generic serialization framework for Rust.
 CBOR provides a binary encoding for a superset
@@ -16,7 +34,7 @@
 Serde CBOR supports Rust 1.40 and up. Add this to your `Cargo.toml`:
 ```toml
 [dependencies]
-serde_cbor = "0.11.1"
+serde_cbor = "0.11.2"
 ```
 
 Storing and loading Rust types is easy and requires only
diff --git a/src/lib.rs b/src/lib.rs
index 1736ce8..5566854 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -66,11 +66,20 @@
 //! # Packed Encoding
 //! When serializing structs or enums in CBOR the keys or enum variant names will be serialized
 //! as string keys to a map. Especially in embedded environments this can increase the file
-//! size too much. In packed encoding the keys and variants will be serialized as variable sized
-//! integers. The first 24 entries in any struct consume only a single byte!
+//! size too much. In packed encoding all struct keys, as well as any enum variant that has no data,
+//! will be serialized as variable sized integers. The first 24 entries in any struct consume only a
+//! single byte!  Packed encoding uses serde's preferred [externally tagged enum
+//! format](https://serde.rs/enum-representations.html) and therefore serializes enum variant names
+//! as string keys when that variant contains data.  So, in the packed encoding example, `FirstVariant`
+//! encodes to a single byte, but encoding `SecondVariant` requires 16 bytes.
+//!
 //! To serialize a document in this format use `Serializer::new(writer).packed_format()` or
 //! the shorthand `ser::to_vec_packed`. The deserialization works without any changes.
 //!
+//! If you would like to omit the enum variant encoding for all variants, including ones that
+//! contain data, you can add `legacy_enums()` in addition to `packed_format()`, as can seen
+//! in the Serialize using minimal encoding example.
+//!
 //! # Self describing documents
 //! In some contexts different formats are used but there is no way to declare the format used
 //! out of band. For this reason CBOR has a magic number that may be added before any document.
@@ -132,6 +141,55 @@
 //! # }
 //! ```
 //!
+//! Serialize using packed encoding
+//!
+//! ```rust
+//! use serde_derive::{Deserialize, Serialize};
+//! use serde_cbor::ser::to_vec_packed;
+//! use WithTwoVariants::*;
+//!
+//! #[derive(Debug, Serialize, Deserialize)]
+//! enum WithTwoVariants {
+//!     FirstVariant,
+//!     SecondVariant(u8),
+//! }
+//!
+//! let cbor = to_vec_packed(&FirstVariant).unwrap();
+//! assert_eq!(cbor.len(), 1);
+//!
+//! let cbor = to_vec_packed(&SecondVariant(0)).unwrap();
+//! assert_eq!(cbor.len(), 16); // Includes 13 bytes of "SecondVariant"
+//! ```
+//!
+//! Serialize using minimal encoding
+//!
+//! ```rust
+//! use serde_derive::{Deserialize, Serialize};
+//! use serde_cbor::{Result, Serializer, ser::{self, IoWrite}};
+//! use WithTwoVariants::*;
+//!
+//! fn to_vec_minimal<T>(value: &T) -> Result<Vec<u8>>
+//! where
+//!     T: serde::Serialize,
+//! {
+//!     let mut vec = Vec::new();
+//!     value.serialize(&mut Serializer::new(&mut IoWrite::new(&mut vec)).packed_format().legacy_enums())?;
+//!     Ok(vec)
+//! }
+//!
+//! #[derive(Debug, Serialize, Deserialize)]
+//! enum WithTwoVariants {
+//!     FirstVariant,
+//!     SecondVariant(u8),
+//! }
+//!
+//! let cbor = to_vec_minimal(&FirstVariant).unwrap();
+//! assert_eq!(cbor.len(), 1);
+//!
+//! let cbor = to_vec_minimal(&SecondVariant(0)).unwrap();
+//! assert_eq!(cbor.len(), 3);
+//! ```
+//!
 //! # `no-std` support
 //!
 //! Serde CBOR supports building in a `no_std` context, use the following lines
diff --git a/src/tags.rs b/src/tags.rs
index 50e039e..8adccb8 100644
--- a/src/tags.rs
+++ b/src/tags.rs
@@ -42,8 +42,7 @@
 
 macro_rules! delegate {
     ($name: ident, $type: ty) => {
-        fn $name<E: serde::de::Error>(self, v: $type) -> Result<Self::Value, E>
-        {
+        fn $name<E: serde::de::Error>(self, v: $type) -> Result<Self::Value, E> {
             T::deserialize(v.into_deserializer()).map(untagged)
         }
     };