pub struct OccupiedEntry<'o, 'a> { /* private fields */ }Expand description
A member that is there; see Entry.
Implementations§
Source§impl<'o, 'a> OccupiedEntry<'o, 'a>
impl<'o, 'a> OccupiedEntry<'o, 'a>
Sourcepub fn into_mut(self) -> &'o mut Value<'a>
pub fn into_mut(self) -> &'o mut Value<'a>
The value, mutably, for as long as the object is borrowed.
Sourcepub fn insert(&mut self, value: impl Into<Value<'a>>) -> Value<'a>
pub fn insert(&mut self, value: impl Into<Value<'a>>) -> Value<'a>
Replaces the value and returns the old one.
Sourcepub fn remove(self) -> Value<'a>
pub fn remove(self) -> Value<'a>
Removes the member, keeping the others’ order, and returns its value.
§Examples
use jsonx_lib::Entry;
let mut v = jsonx_lib::json!({ "a": 1, "b": 2 });
if let Entry::Occupied(e) = v.as_object_mut().unwrap().entry("a") {
assert_eq!(e.remove(), 1);
}
assert_eq!(v.to_string(), r#"{"b":2}"#);Trait Implementations§
Auto Trait Implementations§
impl<'o, 'a> !UnwindSafe for OccupiedEntry<'o, 'a>
impl<'o, 'a> Forget for OccupiedEntry<'o, 'a>
impl<'o, 'a> Freeze for OccupiedEntry<'o, 'a>
impl<'o, 'a> Move for OccupiedEntry<'o, 'a>
impl<'o, 'a> RefUnwindSafe for OccupiedEntry<'o, 'a>
impl<'o, 'a> Send for OccupiedEntry<'o, 'a>
impl<'o, 'a> Sync for OccupiedEntry<'o, 'a>
impl<'o, 'a> Unpin for OccupiedEntry<'o, 'a>
impl<'o, 'a> UnsafeUnpin for OccupiedEntry<'o, 'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more