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§
Sourcefn fetch_bytes(&self) -> FailFuture<'_, ByteNode>
fn fetch_bytes(&self) -> FailFuture<'_, ByteNode>
Sourcefn fetch_data(&self) -> FailFuture<'_, Vec<u8>>
fn fetch_data(&self) -> FailFuture<'_, Vec<u8>>
Only fetch data.
Provided Methods§
Sourcefn fetch_bytes_local(&self) -> Result<Option<ByteNode>>
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.
Sourcefn fetch_data_local(&self) -> Option<Vec<u8>>
fn fetch_data_local(&self) -> Option<Vec<u8>>
Returns data if it’s local and trivially/infallibly available.
Sourcefn as_inner(&self) -> Option<&dyn Any>
fn as_inner(&self) -> Option<&dyn Any>
Reduce to some known grounded value, preferably one implementing FetchBytes. Typically,
this is addressed::AddressedBytes.
Sourcefn as_resolve(&self) -> Option<&Arc<dyn Resolve>>
fn as_resolve(&self) -> Option<&Arc<dyn Resolve>>
Generalisation of FetchBytes::as_inner where we’re only interested in the Resolve
component.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".