Skip to main content

UploadError

Enum UploadError 

Source
#[non_exhaustive]
pub enum UploadError {
Show 15 variants HeaderMissing { stream_empty: bool, }, UnexpectedMessage { header: bool, }, BadPackId { chunk: bool, len: Option<usize>, }, PackIdMismatch, TotalMissing, TotalTooLarge { total: u64, cap: u64, }, TooManyChunks, OffsetMissing, OffsetGap { offset: u64, expected: u64, }, ByteCountOverflow, Overrun, AfterLast, NoLast, LengthMismatch { received: u64, declared: u64, }, DigestMismatch,
}
Expand description

Why an upload stream was rejected.

The stream-shape variants (Self::HeaderMissing, Self::UnexpectedMessage) and Self::DigestMismatch are raised by the binding, which decodes messages and owns the sink; the validator raises every other variant.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

HeaderMissing

The stream did not start with a header. stream_empty when it ended before any message.

Fields

§stream_empty: bool

No message arrived at all.

§

UnexpectedMessage

A message after the header was not a chunk. header when it was a second header, otherwise a message with no body.

Fields

§header: bool

The message was a second header.

§

BadPackId

A pack_id that is absent (len: None) or not 32 bytes long. chunk when it was a chunk’s rather than the header’s.

Fields

§chunk: bool

The id came from a chunk.

§len: Option<usize>

Its length, or None when absent.

§

PackIdMismatch

A chunk’s pack_id differs from the header’s.

§

TotalMissing

The header has no total_bytes.

§

TotalTooLarge

The declared total_bytes is over the binding’s cap.

Fields

§total: u64

Declared size.

§cap: u64

The binding’s cap.

§

TooManyChunks

More chunks than the binding’s cap arrived without last.

§

OffsetMissing

A chunk has no offset.

§

OffsetGap

A chunk’s offset is not the running byte count.

Fields

§offset: u64

The chunk’s offset.

§expected: u64

The running byte count.

§

ByteCountOverflow

The running byte count overflowed u64.

§

Overrun

The chunks carry more bytes than the header declared.

§

AfterLast

A chunk arrived after the last one.

§

NoLast

The stream ended without a last chunk.

§

LengthMismatch

The last chunk arrived before the declared byte count.

Fields

§received: u64

Bytes received.

§declared: u64

Bytes the header declared.

§

DigestMismatch

The received bytes do not hash to the header’s pack_id.

Implementations§

Source§

impl UploadError

Source

pub const fn code(self) -> Code

The Connect-side code: Code::ResourceExhausted for an oversized declared total, Code::InvalidArgument for everything else.

Source

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

mkit serve’s message, verbatim. Every one is sent with ERROR_CODE_INVALID_REQUEST; the ssh binding maps codes itself.

Source

pub fn connect_message(self) -> Cow<'static, str>

mkit-transport-connect’s message, verbatim. TotalMissing, OffsetMissing, TooManyChunks and AfterLast are new: that server reads an absent total_bytes or offset as 0, has no chunk cap and stops reading at last.

Trait Implementations§

Source§

impl Clone for UploadError

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 UploadError

Source§

impl Debug for UploadError

Source§

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

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

impl Eq for UploadError

Source§

impl From<UploadError> for ServerError

Source§

fn from(err: UploadError) -> Self

The Connect code and message.

Source§

impl PartialEq for UploadError

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 UploadError

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> 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<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<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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSync for T
where T: Sync + ?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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more