pub struct SessionMetadata { /* private fields */ }Expand description
Metadata imported from either a legacy plain object or the Rust envelope. The map intentionally retains unknown keys for forward compatibility.
Implementations§
Source§impl SessionMetadata
impl SessionMetadata
pub fn new(data: Map<String, Value>) -> Self
pub fn empty() -> Self
pub fn schema_version(&self) -> u32
pub fn get(&self, key: &str) -> Option<&Value>
Sourcepub fn insert(
&mut self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Option<Value>
pub fn insert( &mut self, key: impl Into<String>, value: impl Into<Value>, ) -> Option<Value>
Replace one metadata value while retaining all other keys.
Sourcepub fn remove(&mut self, key: &str) -> Option<Value>
pub fn remove(&mut self, key: &str) -> Option<Value>
Remove one metadata value, returning the previous value when present.
pub fn as_object(&self) -> &Map<String, Value>
Sourcepub fn to_value(&self) -> Value
pub fn to_value(&self) -> Value
Flattened JSON keeps existing roster/agent_data keys addressable.
pub fn to_json(&self) -> Result<String, PersistenceError>
Trait Implementations§
Source§impl Clone for SessionMetadata
impl Clone for SessionMetadata
Source§fn clone(&self) -> SessionMetadata
fn clone(&self) -> SessionMetadata
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionMetadata
impl Debug for SessionMetadata
impl Eq for SessionMetadata
Source§impl PartialEq for SessionMetadata
impl PartialEq for SessionMetadata
impl StructuralPartialEq for SessionMetadata
Auto Trait Implementations§
impl Freeze for SessionMetadata
impl RefUnwindSafe for SessionMetadata
impl Send for SessionMetadata
impl Sync for SessionMetadata
impl Unpin for SessionMetadata
impl UnsafeUnpin for SessionMetadata
impl UnwindSafe for SessionMetadata
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