pub struct WithContext<T> {
pub context: Context,
pub inner: T,
}Expand description
Wraps any Activity Streams payload with a JSON-LD @context.
Use this on outbound values to ensure conformant serialization; inbound
values typically carry their own @context and can be deserialized
directly into this type.
§Examples
let obj = Object::with_kind("Note");
let wrapped = WithContext::new(obj);
let json = serde_json::to_string(&wrapped).unwrap();
assert!(json.contains("@context"));Fields§
§context: ContextThe JSON-LD context of the payload.
inner: TThe wrapped payload. Flattened in the wire format.
Implementations§
Source§impl<T> WithContext<T>
impl<T> WithContext<T>
Trait Implementations§
Source§impl<T: Clone> Clone for WithContext<T>
impl<T: Clone> Clone for WithContext<T>
Source§fn clone(&self) -> WithContext<T>
fn clone(&self) -> WithContext<T>
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<T: Debug> Debug for WithContext<T>
impl<T: Debug> Debug for WithContext<T>
Source§impl<'de, T> Deserialize<'de> for WithContext<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for WithContext<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<T: Eq> Eq for WithContext<T>
Source§impl<T: PartialEq> PartialEq for WithContext<T>
impl<T: PartialEq> PartialEq for WithContext<T>
Source§fn eq(&self, other: &WithContext<T>) -> bool
fn eq(&self, other: &WithContext<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<T> Serialize for WithContext<T>where
T: Serialize,
impl<T> Serialize for WithContext<T>where
T: Serialize,
impl<T: PartialEq> StructuralPartialEq for WithContext<T>
Auto Trait Implementations§
impl<T> Freeze for WithContext<T>where
T: Freeze,
impl<T> RefUnwindSafe for WithContext<T>where
T: RefUnwindSafe,
impl<T> Send for WithContext<T>where
T: Send,
impl<T> Sync for WithContext<T>where
T: Sync,
impl<T> Unpin for WithContext<T>where
T: Unpin,
impl<T> UnsafeUnpin for WithContext<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for WithContext<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.