pub struct SubscriptionMessage(/* private fields */);
Available on crate feature
server
only.Expand description
Subscription message.
Implementations§
source§impl SubscriptionMessage
impl SubscriptionMessage
sourcepub fn from_json(t: &impl Serialize) -> Result<Self, Error>
pub fn from_json(t: &impl Serialize) -> Result<Self, Error>
Create a new subscription message from JSON.
Fails if the value couldn’t be serialized.
sourcepub fn new(
method: &str,
subscription: SubscriptionId<'_>,
result: &impl Serialize,
) -> Result<Self, Error>
pub fn new( method: &str, subscription: SubscriptionId<'_>, result: &impl Serialize, ) -> Result<Self, Error>
Create a subscription message this is more efficient than SubscriptionMessage::from_json
because it only allocates once.
Fails if the json result
couldn’t be serialized.
Trait Implementations§
source§impl Clone for SubscriptionMessage
impl Clone for SubscriptionMessage
source§fn clone(&self) -> SubscriptionMessage
fn clone(&self) -> SubscriptionMessage
Returns a copy of the value. Read more
1.0.0 · 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 SubscriptionMessage
impl Debug for SubscriptionMessage
Auto Trait Implementations§
impl Freeze for SubscriptionMessage
impl RefUnwindSafe for SubscriptionMessage
impl Send for SubscriptionMessage
impl Sync for SubscriptionMessage
impl Unpin for SubscriptionMessage
impl UnwindSafe for SubscriptionMessage
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)