pub struct BlobHandle {
pub token: BlobToken,
pub path: PathBuf,
}Expand description
Handle to a locally available blob
Returned after successfully fetching a blob. Provides access to the local file path where the blob content is stored.
Fields§
§token: BlobTokenToken identifying the blob
path: PathBufLocal filesystem path to blob content
Implementations§
Source§impl BlobHandle
impl BlobHandle
Sourcepub fn new(token: BlobToken, path: PathBuf) -> BlobHandle
pub fn new(token: BlobToken, path: PathBuf) -> BlobHandle
Create a new blob handle
Sourcepub async fn read_to_vec(&self) -> Result<Vec<u8>, Error>
pub async fn read_to_vec(&self) -> Result<Vec<u8>, Error>
Read the blob content into memory
§Warning
Only use for small blobs! For large blobs, use open_read_stream.
Sourcepub async fn open_read_stream(&self) -> Result<File, Error>
pub async fn open_read_stream(&self) -> Result<File, Error>
Open the blob content as an async byte stream.
Returns a tokio::fs::File which implements AsyncRead.
Use this instead of read_to_vec for large blobs to avoid
buffering the entire content in memory.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BlobHandle
impl RefUnwindSafe for BlobHandle
impl Send for BlobHandle
impl Sync for BlobHandle
impl Unpin for BlobHandle
impl UnsafeUnpin for BlobHandle
impl UnwindSafe for BlobHandle
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more