Skip to main content

Refusal

Enum Refusal 

Source
pub enum Refusal {
Show 17 variants Empty, Reserved(Form), WrongSample { form: Form, sample: SampleKind, }, KeyKind { form: Form, kind: KindToken, }, DeleteTag(Tag), HeldTag(Tag), RequestRun, KeyStamp { wide: bool, }, Short { need: usize, have: usize, }, Trailing(usize), Cause { code: Code, cause: Option<Cause>, }, Detail(Code), Extension, MessageShort { need: usize, have: usize, }, Utf8, Time, Held(Stamp),
}
Expand description

Why bytes are not an envelope or a form of their sample. The variants are in §7.5’s order, which is the order they are found in: CH’s checks, the stamp, a delete’s end, then an error’s byte and what follows it.

Variants§

§

Empty

No byte at all, so no CH.

§

Reserved(Form)

A form this version reserves: an event.

§

WrongSample

A form the sample does not carry (SampleKind::carries).

Fields

§form: Form
§sample: SampleKind
§

KeyKind

A frame on a key whose kind token is not stream (core 0.83), or a snapshot on one that is neither state nor @state (core 0.97).

Fields

§form: Form
§

DeleteTag(Tag)

A delete whose tag is not 0.

§

HeldTag(Tag)

A held stamp whose tag is not 0 (core 0.110): on a state GET, or on a GET’s reply that is a snapshot’s envelope with no byte after its seq.

§

RequestRun

A request whose width bit is 1: a request carries no run (core 0.92).

§

KeyStamp

An event whose key’s last chunk is not an occurrence chunk of CH’s width (core 0.101): the other width’s, any other chunk, or no key at all.

Fields

§wide: bool
§

Short

Fewer bytes than CH, the run and the seq need, and an error’s byte after them.

Fields

§need: usize
§have: usize
§

Trailing(usize)

Bytes after a delete’s seq, or after an error that ends with its message or its byte, where no detail follows.

§

Cause

An error’s cause on a code other than unavailable, or none on unavailable (core 0.92).

Fields

§code: Code
§cause: Option<Cause>
§

Detail(Code)

An error’s detail on a code other than app.

§

Extension

An error’s extension bit set, which this version leaves 0.

§

MessageShort

An error’s message cut short: no length byte, or fewer bytes than it states.

Fields

§need: usize
§have: usize
§

Utf8

An error’s message that is not UTF-8, as RFC 3629 defines it.

§

Time

An event’s time with an unused code (core 0.101): an ms16 above 999, or any but 0 under a t32 of all ones.

§

Held(Stamp)

A held stamp that is no owner’s answer to its reader (core 0.110 §4.2, “A held stamp in answer”): one that differs from the stamp its GET carried, one in reply to a GET that carried none, one on another key, or one heard on a subscription. Its bytes parse (§7.5); it establishes nothing, merges nothing, and is counted undecodable. Not a refusal of §7.5’s parse: the reader’s, which knows what it asked (crate::seed::Asked::read).

Implementations§

Source§

impl Refusal

Source

pub const fn token(&self) -> &'static str

The reason token spec/conformance/envelope/vectors.json, carries.json and spec/conformance/errors/forms.json pin: short, form, sample_kind, key_kind, tag, request_run, key_stamp, trailing, time, cause, detail, extension or utf8; and held, seed/held.json’s, for a held stamp that is no answer.

Source§

impl Refusal

Source

pub fn reason(&self) -> String

Why a refused envelope’s sample is undecodable, for a person and a script alike: the refusal’s token after a fixed prefix, zk2c envelope refused: short. A held stamp that is no answer (Refusal::Held) is named as what it is, with its stamp, before its token, held: its bytes parse, and it is no page cut short.

Trait Implementations§

Source§

impl Clone for Refusal

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Refusal

Source§

impl Debug for Refusal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Refusal

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Refusal

Source§

impl Error for Refusal

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Replaced by Error::source.
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for Refusal

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Refusal

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsNode<T> for T

Source§

fn as_node(&self) -> &T

Source§

impl<T> AsNodeMut<T> for T

Source§

fn as_node_mut(&mut self) -> &mut T

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.