pub enum ChunkingError {
InvalidPayloadLengthError {
received: usize,
expected: usize,
},
TooLongPayloadLengthError {
received: usize,
expected_at_most: usize,
},
MalformedHeaderError,
TooShortFragmentHeader {
received: usize,
expected: usize,
},
MalformedFragmentIdentifier {
received: i32,
},
}Expand description
The idea behind the process of chunking is to incur as little data overhead as possible due to very computationally costly sphinx encapsulation procedure.
To achieve this, the underlying message is split into so-called “sets”, which are further subdivided into the base unit of “fragment” that is directly encapsulated by a Sphinx packet. This allows to encapsulate messages of arbitrary length.
Each message, regardless of its size, consists of at least a single Set that has at least
a single Fragment.
Each Fragment can have variable, yet fully deterministic, length,
that depends on its position in the set as well as total number of sets. This is further
explained in fragment.rs file.
Similarly, each Set can have a variable number of Fragments inside. However, that
value is more restrictive: if it’s the last set into which the message was split
(or implicitly the only one), it has no lower bound on the number of Fragments.
(Apart from the restriction of containing at least a single one). If the set is located
somewhere in the middle, it must be full. Finally, regardless of its position, it must also be
true that it contains no more than u8::MAX, i.e. 255 Fragments.
Again, the reasoning for this is further explained in set.rs file. However, you might
also want to look at fragment.rs to understand the full context behind that design choice.
Both of those concepts as well as their structures, i.e. Set and Fragment
are further explained in the respective files.
Variants§
InvalidPayloadLengthError
TooLongPayloadLengthError
MalformedHeaderError
TooShortFragmentHeader
MalformedFragmentIdentifier
Trait Implementations§
Source§impl Debug for ChunkingError
impl Debug for ChunkingError
Source§impl Display for ChunkingError
impl Display for ChunkingError
Source§impl Error for ChunkingError
impl Error for ChunkingError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl PartialEq for ChunkingError
impl PartialEq for ChunkingError
impl Eq for ChunkingError
impl StructuralPartialEq for ChunkingError
Auto Trait Implementations§
impl Freeze for ChunkingError
impl RefUnwindSafe for ChunkingError
impl Send for ChunkingError
impl Sync for ChunkingError
impl Unpin for ChunkingError
impl UnwindSafe for ChunkingError
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
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.