Last active
August 26, 2019 04:41
-
-
Save lupyuen/ef92789353dc883c4da72f950e577fb4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! parse { | |
... | |
(@$enc:ident @object $obj:ident [$($key:tt)+] ($value:expr) , $($rest:tt)*) => { | |
d!(adding key: $($key)+ value: $value to object: $obj); | |
// Append the key and value to the "values" array e.g. | |
// {"key":"device", "value":"010203"}, | |
$crate::coap_item_str!(@$enc $obj, $($key)+, $value); | |
// Continue parsing the rest of the JSON. | |
$crate::parse!(@$enc @object $obj () ($($rest)*) ($($rest)*)); | |
}; | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment