| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#; |
| 2 | |
| 3 | use serde_jsonrust-analyzer cargo serde_json 1.0.114 crate/::valuerust-analyzer cargo serde_json 1.0.114 value/::Valuerust-analyzer cargo serde_json 1.0.114 value/Value# as Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#; |
| 4 | |
| 5 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 6 | pub struct LocalVarsrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars# { |
| 7 | firstrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#first.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#>, |
| 8 | lastrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#last.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#>, |
| 9 | indexrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#index.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#>, |
| 10 | keyrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#key.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#>, |
| 11 | |
| 12 | extrarust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#extra.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#>, |
| 13 | } |
| 14 | |
| 15 | impl LocalVarsrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars# { |
| 16 | pub fn putrust-analyzer cargo handlebars 5.1.2 local_vars/impl#[LocalVars]put().(&mut self, key: &str, value: Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#) { |
| 17 | match key { |
| 18 | "first" => self.firstrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#first. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value), |
| 19 | "last" => self.lastrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#last. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value), |
| 20 | "index" => self.indexrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#index. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value), |
| 21 | "key" => self.keyrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#key. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value), |
| 22 | _ => { |
| 23 | self.extrarust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#extra..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(key.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), value); |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | pub fn getrust-analyzer cargo handlebars 5.1.2 local_vars/impl#[LocalVars]get().(&self, key: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#> { |
| 29 | match key { |
| 30 | "first" => self.firstrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#first..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(), |
| 31 | "last" => self.lastrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#last..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(), |
| 32 | "index" => self.indexrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#index..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(), |
| 33 | "key" => self.keyrust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#key..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(), |
| 34 | _ => self.extrarust-analyzer cargo handlebars 5.1.2 local_vars/LocalVars#extra..getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(key), |
| 35 | } |
| 36 | } |
| 37 | } |