Lines Matching +full:get +full:- +full:item
6 use crate::{value, InlineTable, InternalString, Item, Table, Value};
9 // https://github.com/serde-rs/json/blob/master/src/value/index.rs
13 fn index<'v>(&self, val: &'v Item) -> Option<&'v Item>; in index() argument
15 fn index_mut<'v>(&self, val: &'v mut Item) -> Option<&'v mut Item>; in index_mut() argument
19 fn index<'v>(&self, v: &'v Item) -> Option<&'v Item> { in index() argument
21 Item::ArrayOfTables(ref aot) => aot.values.get(*self), in index()
22 Item::Value(ref a) if a.is_array() => a.as_array().and_then(|a| a.values.get(*self)), in index()
26 fn index_mut<'v>(&self, v: &'v mut Item) -> Option<&'v mut Item> { in index_mut() argument
28 Item::ArrayOfTables(ref mut vec) => vec.values.get_mut(*self), in index_mut()
29 Item::Value(ref mut a) => a.as_array_mut().and_then(|a| a.values.get_mut(*self)), in index_mut()
36 fn index<'v>(&self, v: &'v Item) -> Option<&'v Item> { in index() argument
38 Item::Table(ref t) => t.get(self), in index()
39 Item::Value(ref v) => v in index()
41 .and_then(|t| t.items.get(self)) in index()
52 fn index_mut<'v>(&self, v: &'v mut Item) -> Option<&'v mut Item> { in index_mut() argument
53 if let Item::None = *v { in index_mut()
57 TableKeyValue::new(Key::new(self), Item::None), in index_mut()
62 Item::Table(ref mut t) => Some(t.entry(self).or_insert(Item::None)), in index_mut()
63 Item::Value(ref mut v) => v.as_inline_table_mut().map(|t| { in index_mut()
67 .or_insert_with(|| TableKeyValue::new(Key::new(self), Item::None)) in index_mut()
76 fn index<'v>(&self, v: &'v Item) -> Option<&'v Item> { in index() argument
79 fn index_mut<'v>(&self, v: &'v mut Item) -> Option<&'v mut Item> { in index_mut() argument
88 fn index<'v>(&self, v: &'v Item) -> Option<&'v Item> { in index() argument
91 fn index_mut<'v>(&self, v: &'v mut Item) -> Option<&'v mut Item> { in index_mut() argument
96 impl<I> ops::Index<I> for Item implementation
100 type Output = Item;
102 fn index(&self, index: I) -> &Item { in index() argument
107 impl<I> ops::IndexMut<I> for Item implementation
111 fn index_mut(&mut self, index: I) -> &mut Item { in index_mut() argument
117 type Output = Item;
119 fn index(&self, key: &'s str) -> &Item { in index() argument
120 self.get(key).expect("index not found") in index()
125 fn index_mut(&mut self, key: &'s str) -> &mut Item { in index_mut() argument
126 self.entry(key).or_insert(Item::None) in index_mut()
133 fn index(&self, key: &'s str) -> &Value { in index()
134 self.get(key).expect("index not found") in index()
139 fn index_mut(&mut self, key: &'s str) -> &mut Value { in index_mut()
145 type Output = Item;
147 fn index(&self, key: &'s str) -> &Item { in index() argument
153 fn index_mut(&mut self, key: &'s str) -> &mut Item { in index_mut() argument