Struct zng_view_api::api_extension::ApiExtensionPayload
source · pub struct ApiExtensionPayload(pub Vec<u8>);Expand description
Custom serialized data, in a format defined by the extension.
Note that the bytes here should represent a serialized small struct only, you
can add an IpcBytes or IpcBytesReceiver field to this struct to transfer
large payloads.
Tuple Fields§
§0: Vec<u8>Implementations§
source§impl ApiExtensionPayload
impl ApiExtensionPayload
sourcepub fn deserialize<T: DeserializeOwned>(
&self
) -> Result<T, ApiExtensionRecvError>
pub fn deserialize<T: DeserializeOwned>( &self ) -> Result<T, ApiExtensionRecvError>
Deserialize the payload.
sourcepub fn unknown_extension(extension_id: ApiExtensionId) -> Self
pub fn unknown_extension(extension_id: ApiExtensionId) -> Self
Value returned when an invalid extension is requested.
Value is a string "zng-view-api.unknown_extension;id={extension_id}".
sourcepub fn invalid_request(
extension_id: ApiExtensionId,
error: impl Display
) -> Self
pub fn invalid_request( extension_id: ApiExtensionId, error: impl Display ) -> Self
Value returned when an invalid request is made for a valid extension key.
Value is a string "zng-view-api.invalid_request;id={extension_id};error={error}".
sourcepub fn parse_unknown_extension(&self) -> Option<ApiExtensionId>
pub fn parse_unknown_extension(&self) -> Option<ApiExtensionId>
If the payload is an unknown_extension error message, returns the key.
if the payload starts with the invalid request header and the key cannot be retrieved the
ApiExtensionId::INVALID is returned as the key.
sourcepub fn parse_invalid_request(&self) -> Option<(ApiExtensionId, &str)>
pub fn parse_invalid_request(&self) -> Option<(ApiExtensionId, &str)>
If the payload is an invalid_request error message, returns the key and error.
if the payload starts with the invalid request header and the key cannot be retrieved the
ApiExtensionId::INVALID is returned as the key and the error message will mention “corrupted payload”.
Trait Implementations§
source§impl Clone for ApiExtensionPayload
impl Clone for ApiExtensionPayload
source§fn clone(&self) -> ApiExtensionPayload
fn clone(&self) -> ApiExtensionPayload
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ApiExtensionPayload
impl Debug for ApiExtensionPayload
source§impl<'de> Deserialize<'de> for ApiExtensionPayload
impl<'de> Deserialize<'de> for ApiExtensionPayload
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>,
source§impl Hash for ApiExtensionPayload
impl Hash for ApiExtensionPayload
source§impl PartialEq for ApiExtensionPayload
impl PartialEq for ApiExtensionPayload
source§fn eq(&self, other: &ApiExtensionPayload) -> bool
fn eq(&self, other: &ApiExtensionPayload) -> bool
self and other values to be equal, and is used
by ==.