MaybeProcessedBlock

Enum MaybeProcessedBlock 

Source
pub enum MaybeProcessedBlock<T, E> {
    Raw(Vec<u8>),
    Processed(Result<T, E>),
}

Variants§

§

Raw(Vec<u8>)

A block that’s probably a Node (but we can’t know yet)

It can be a record that suspiciously looks a lot like a node, so we cannot eagerly turn it into a Node. We only know for sure what it is when we actually walk down the MST

§

Processed(Result<T, E>)

A processed record from a block that was definitely not a Node

Processing has to be fallible because the CAR can have totally-unused blocks, which can just be garbage. since we’re eagerly trying to process record blocks without knowing for sure that they are records, we discard any definitely-not-nodes that fail processing and keep their error in the buffer for them. if we later try to retreive them as a record, then we can surface the error.

If we never needed this block, then we may have wasted a bit of effort trying to process it. Oh well.

There’s an alternative here, which would be to kick unprocessable blocks back to Raw, or maybe even a new RawUnprocessable variant. Then we could surface the typed error later if needed by trying to reprocess.

Trait Implementations§

Source§

impl<T: Debug, E: Debug> Debug for MaybeProcessedBlock<T, E>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, E> Freeze for MaybeProcessedBlock<T, E>
where T: Freeze, E: Freeze,

§

impl<T, E> RefUnwindSafe for MaybeProcessedBlock<T, E>

§

impl<T, E> Send for MaybeProcessedBlock<T, E>
where T: Send, E: Send,

§

impl<T, E> Sync for MaybeProcessedBlock<T, E>
where T: Sync, E: Sync,

§

impl<T, E> Unpin for MaybeProcessedBlock<T, E>
where T: Unpin, E: Unpin,

§

impl<T, E> UnwindSafe for MaybeProcessedBlock<T, E>
where T: UnwindSafe, E: UnwindSafe,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.