Skip to main content

FetchBytes

Trait FetchBytes 

Source
pub trait FetchBytes: AsAny {
    // Required methods
    fn fetch_bytes(&self) -> FailFuture<'_, ByteNode>;
    fn fetch_data(&self) -> FailFuture<'_, Vec<u8>>;

    // Provided methods
    fn fetch_bytes_local(&self) -> Result<Option<ByteNode>> { ... }
    fn fetch_data_local(&self) -> Option<Vec<u8>> { ... }
    fn as_inner(&self) -> Option<&dyn Any> { ... }
    fn as_resolve(&self) -> Option<&Arc<dyn Resolve>> { ... }
    fn try_unwrap_resolve(self: Arc<Self>) -> Option<Arc<dyn Resolve>> { ... }
}
Expand description

Main machinery responsible for turning content-addressed structures into something we can actually traverse.

Required Methods§

Source

fn fetch_bytes(&self) -> FailFuture<'_, ByteNode>

Central method for traversal of [Hash]-based pointers. Returns byte data and Resolve for use in Parse.

Source

fn fetch_data(&self) -> FailFuture<'_, Vec<u8>>

Only fetch data.

Provided Methods§

Source

fn fetch_bytes_local(&self) -> Result<Option<ByteNode>>

Attempt to fetch a node as if it’s local. Returns None if it’s not known to be local.

Source

fn fetch_data_local(&self) -> Option<Vec<u8>>

Returns data if it’s local and trivially/infallibly available.

Source

fn as_inner(&self) -> Option<&dyn Any>

Reduce to some known grounded value, preferably one implementing FetchBytes. Typically, this is addressed::AddressedBytes.

Source

fn as_resolve(&self) -> Option<&Arc<dyn Resolve>>

Generalisation of FetchBytes::as_inner where we’re only interested in the Resolve component.

Source

fn try_unwrap_resolve(self: Arc<Self>) -> Option<Arc<dyn Resolve>>

Attempt unwrapping a Resolve. Should be implemented when possible, as it’s use for some anti-stack-overflow machinery.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: ?Sized + FetchBytes> FetchBytes for Arc<T>

Implementors§