Lines Matching refs:key
92 /// Checks whether the specified key exists in the Object.
104 pub fn contains_key(&self, key: &str) -> bool {
105 self.inner.iter().any(|(k, _)| k == key)
108 /// Inserts the specified key and value into an Object, appending them to the end without deduplication.
119 pub fn insert(&mut self, key: String, value: JsonValue) {
120 self.inner.push((key, value))
123 /// Removes the element under the specified key from the Object.If there is an element with
136 pub fn remove(&mut self, key: &str) -> Option<JsonValue> {
137 let pos = self.inner.iter().position(|(k, _)| k == key)?;
167 /// Gets a common reference to the element in Object with the specified key.
180 pub fn get(&self, key: &str) -> Option<&JsonValue> {
181 self.inner.iter().find(|(k, _)| k == key).map(|(_, v)| v)
184 /// Gets a mutable reference to the element in Object with the specified key.
197 pub fn get_mut(&mut self, key: &str) -> Option<&mut JsonValue> {
200 .find(|(k, _)| k == key)
218 /// and the key-value pair can be one-to-one and exactly equal.
248 for (n, (key, value)) in self.inner.iter().enumerate() {
252 write!(f, "\"{key}\":{value}")?;