pub struct StandaloneWrite { /* private fields */ }Expand description
A type that can write all bindle data to the configured location as a standalone bindle
Implementations§
Source§impl StandaloneWrite
impl StandaloneWrite
Sourcepub async fn new<P, I>(base_path: P, bindle_id: I) -> Result<StandaloneWrite>
pub async fn new<P, I>(base_path: P, bindle_id: I) -> Result<StandaloneWrite>
Returns a new StandaloneWrite that can write all components of a bindle as a standalone
bindle using the given base path and bindle ID
use bindle::standalone::StandaloneWrite;
StandaloneWrite::new("/foo/bar", "example.com/baz/1.0.0").await.unwrap();In the above example, the StandaloneWrite will be configured to write all the bindle data
into the /foo/bar/187e908f466500c76c13953c3191fafa869c277e2689f451e92d75cda32452df
directory
Sourcepub fn path(&self) -> &Path
pub fn path(&self) -> &Path
Returns a reference to the output directory for this standalone bindle
Sourcepub async fn tarball(self, output_dir: impl AsRef<Path>) -> Result<()>
pub async fn tarball(self, output_dir: impl AsRef<Path>) -> Result<()>
Creates a tarball, consuming the StandaloneWrite and outputting the tarball at the given
path
Sourcepub async fn write<T: AsyncRead + Unpin + Send + Sync>(
&self,
inv: Invoice,
parcels: HashMap<String, T>,
) -> Result<()>
pub async fn write<T: AsyncRead + Unpin + Send + Sync>( &self, inv: Invoice, parcels: HashMap<String, T>, ) -> Result<()>
Writes the given invoice and HashMap of parcels (as readers). The key of the HashMap
should be the SHA of the parcel
The HashMap key should be the sha256 of the data, and the value should be the parcel content.
Auto Trait Implementations§
impl Freeze for StandaloneWrite
impl RefUnwindSafe for StandaloneWrite
impl Send for StandaloneWrite
impl Sync for StandaloneWrite
impl Unpin for StandaloneWrite
impl UnwindSafe for StandaloneWrite
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<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> 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>
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>
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