Struct grafana_plugin_sdk::backend::StreamPacket
source · pub struct StreamPacket<J = ()> { /* private fields */ }
Expand description
A packet of data to be streamed back to the subscribed client.
Such data can be:
- a
Frame
, which will be serialized to JSON before being sent back to the client - arbitrary JSON
- arbitrary bytes.
The J
type parameter on this enum is only relevant when JSON data
is being streamed back,
Implementations§
source§impl<J> StreamPacket<J>
impl<J> StreamPacket<J>
sourcepub fn from_frame(frame: CheckedFrame<'_>) -> Result<Self, ConvertToError>
pub fn from_frame(frame: CheckedFrame<'_>) -> Result<Self, ConvertToError>
Create a StreamPacket
representing a Frame
.
sourcepub fn from_json(json: &J) -> Result<Self, ConvertToError>where
J: Serialize,
pub fn from_json(json: &J) -> Result<Self, ConvertToError>where
J: Serialize,
Create a StreamPacket
representing some JSON.
sourcepub fn from_bytes(data: Vec<u8>) -> Self
pub fn from_bytes(data: Vec<u8>) -> Self
Create a StreamPacket
from arbitrary bytes.
Trait Implementations§
Auto Trait Implementations§
impl<J> RefUnwindSafe for StreamPacket<J>where
J: RefUnwindSafe,
impl<J> Send for StreamPacket<J>where
J: Send,
impl<J> Sync for StreamPacket<J>where
J: Sync,
impl<J> Unpin for StreamPacket<J>where
J: Unpin,
impl<J> UnwindSafe for StreamPacket<J>where
J: 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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request