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§impl Serialize for ApiExtensionPayload
impl Serialize for ApiExtensionPayload
impl Eq for ApiExtensionPayload
impl StructuralPartialEq for ApiExtensionPayload
Auto Trait Implementations§
impl Freeze for ApiExtensionPayload
impl RefUnwindSafe for ApiExtensionPayload
impl Send for ApiExtensionPayload
impl Sync for ApiExtensionPayload
impl Unpin for ApiExtensionPayload
impl UnwindSafe for ApiExtensionPayload
Blanket Implementations§
source§impl<T> AnyVarValue for Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self
equals other
.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
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)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more