Update read_cbor_map example to use a text key as well.

This commit is contained in:
Guillaume Endignoux
2020-06-15 17:00:19 +02:00
parent 493efa9b25
commit 2589eb99b3

View File

@@ -46,7 +46,7 @@ use core::iter::Peekable;
/// read_cbor_map! { /// read_cbor_map! {
/// let { /// let {
/// 1 => x, /// 1 => x,
/// 2 => y, /// "key" => y,
/// } = map; /// } = map;
/// }; /// };
/// # } /// # }
@@ -59,8 +59,9 @@ use core::iter::Peekable;
/// # /// #
/// # fn main() { /// # fn main() {
/// # let mut map = alloc::collections::BTreeMap::<cbor::KeyType, _>::new(); /// # let mut map = alloc::collections::BTreeMap::<cbor::KeyType, _>::new();
/// let x: Option<cbor::Value> = map.remove(&cbor_unsigned!(1)); /// use cbor::values::IntoCborKey;
/// let y: Option<cbor::Value> = map.remove(&cbor_unsigned!(2)); /// let x: Option<cbor::Value> = map.remove(&1.into_cbor_key());
/// let y: Option<cbor::Value> = map.remove(&"key".into_cbor_key());
/// # } /// # }
/// ``` /// ```
#[macro_export] #[macro_export]