pub struct ErrorForm<'a> {
pub tag: Tag,
pub stamp: Stamp,
pub code: Code,
pub cause: Option<Cause>,
pub message: Option<&'a str>,
pub detail: Option<&'a [u8]>,
}Expand description
§5.2’s error in bytes (core 0.92, §5.2 “The error form”, §7.5): a
reply_err’s payload, CH · run · seq · error, under zenoh/bytes.
crate::wire::read_reply_err parses one, and every one it accepts
writes back to its bytes.
Fields§
§tag: TagThe operation’s error type’s tag, whether a detail follows or
not; 0 for an operation that declares none. Reported, never checked.
stamp: StampThe replying instance’s as-of mark (§5.1). It attributes nothing: a reply error carries no key.
code: Code§cause: Option<Cause>unavailable’s, and no other code’s.
message: Option<&'a str>For a human, never parsed (§5.2). Some("") is a message present
and empty, apart from an absent one.
detail: Option<&'a [u8]>app’s alone: a value of the operation’s error type, as that type
encodes it, taken unread. It can be empty, as a protobuf message with
no field written is.
Implementations§
Source§impl<'a> ErrorForm<'a>
impl<'a> ErrorForm<'a>
Sourcepub const fn new(
tag: Tag,
stamp: Stamp,
code: Code,
cause: Option<Cause>,
) -> ErrorForm<'a>
pub const fn new( tag: Tag, stamp: Stamp, code: Code, cause: Option<Cause>, ) -> ErrorForm<'a>
An error with no message and no detail.
Sourcepub const fn error_byte(&self) -> ErrorByte
pub const fn error_byte(&self) -> ErrorByte
Its error byte.
Sourcepub fn read(
encoding: &str,
payload: &'a [u8],
) -> Result<ErrorForm<'a>, FormRefusal>
pub fn read( encoding: &str, payload: &'a [u8], ) -> Result<ErrorForm<'a>, FormRefusal>
A reply error read as an error form, by its Encoding first (§5.2,
§7.5): only zenoh/bytes, exactly (wire::ENCODING), carries one,
and a reply error under any other is the transport’s.
§Errors
FormRefusal::Encoding for any other Encoding, a schema suffix
included, else wire::read_reply_err’s refusal.
Sourcepub fn write(&self) -> Result<Vec<u8>, Refusal>
pub fn write(&self) -> Result<Vec<u8>, Refusal>
Its bytes: 7 with a 16-bit run, or 9 with a 32-bit one, then the
message’s length and bytes, and the detail’s. A message over 255
bytes is cut at a character boundary, so it reads back cut.
§Errors
What the parse refuses, which §7.5’s writer MUST NOT write
(ErrorByte::check): Refusal::Cause, then Refusal::Detail.
Trait Implementations§
impl<'a> Copy for ErrorForm<'a>
impl<'a> Eq for ErrorForm<'a>
impl<'a> StructuralPartialEq for ErrorForm<'a>
Auto Trait Implementations§
impl<'a> Forget for ErrorForm<'a>
impl<'a> Freeze for ErrorForm<'a>
impl<'a> Move for ErrorForm<'a>
impl<'a> RefUnwindSafe for ErrorForm<'a>
impl<'a> Send for ErrorForm<'a>
impl<'a> Sync for ErrorForm<'a>
impl<'a> Unpin for ErrorForm<'a>
impl<'a> UnsafeUnpin for ErrorForm<'a>
impl<'a> UnwindSafe for ErrorForm<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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