pub async fn new<P, I>(base_path: P, bindle_id: I) -> Result<StandaloneRead>
    where
        P: AsRef<Path>,
        I: TryInto<Id>,
        I::Error: Into<ClientError>,
    {
        let base = base_path
            .as_ref()
            .join(bindle_id.try_into().map_err(|e| e.into())?.sha());
        let invoice_file = base.join(INVOICE_FILE);
        let parcel_dir = base.join(PARCEL_DIR);
        let stream = tokio::fs::read_dir(&parcel_dir).await?;
        let parcels = stream
            .map(|res| res.map(|entry| entry.path()))
            .collect::<std::io::Result<Vec<_>>>()
            .await?;
        Ok(StandaloneRead {
            invoice_file,
            parcel_dir,
            parcels,
        })
    }
/// Returns a new StandaloneRead constructed using the given base path and bindle ID. It will
/// attempt to list all parcel files, but will not provide any validation such as whether it is
/// a regular file.
///
/// ```no_run
/// use bindle::standalone::StandaloneRead;
/// # #[tokio::main]
/// # async fn main() {
/// StandaloneRead::new("/foo/bar", "example.com/baz/1.0.0").await.unwrap();
/// # }
/// ```
///
/// In the above example, the `StandaloneWrite` will be configured to read bindle data from the
/// `/foo/bar/187e908f466500c76c13953c3191fafa869c277e2689f451e92d75cda32452df` directory
Returns a new StandaloneRead constructed using the given base path and bindle ID. It will
attempt to list all parcel files, but will not provide any validation such as whether it is
a regular file.


Returns a new StandaloneRead constructed using the given base path and bindle ID . It will attempt to list all parcel files but will not provide any validation such as whether it is a regular file .
pub async fn new<P, I>(base_path: P, bindle_id: I) -> Result<StandaloneRead>
    where
        P: AsRef<Path>,
        I: TryInto<Id>,
        I::Error: Into<ClientError>,
    {
        let base = base_path
            .as_ref()
            .join(bindle_id.try_into().map_err(|e| e.into())?.sha());
        let invoice_file = base.join(INVOICE_FILE);
        let parcel_dir = base.join(PARCEL_DIR);
        let stream = tokio::fs::read_dir(&parcel_dir).await?;
        let parcels = stream
            .map(|res| res.map(|entry| entry.path()))
            .collect::<std::io::Result<Vec<_>>>()
            .await?;
        Ok(StandaloneRead {
            invoice_file,
            parcel_dir,
            parcels,
        })
    }
pub async fn new < P , I > ( base_path : P , bindle_id : I ) -> Result < StandaloneRead > where P : AsRef < Path > , I : TryInto < Id > , I :: Error : Into < ClientError > , { let base = base_path . as_ref ( ) . join ( bindle_id . try_into ( ) . map_err ( | e | e . into ( ) ) ? . sha ( ) ) ; let invoice_file = base . join ( INVOICE_FILE ) ; let parcel_dir = base . join ( PARCEL_DIR ) ; let stream = tokio :: fs :: read_dir ( & parcel_dir ) . await ? ; let parcels = stream . map ( | res | res . map ( | entry | entry . path ( ) ) ) . collect :: < std :: io :: Result < Vec < _ > > > ( ) . await ? ; Ok ( StandaloneRead { invoice_file , parcel_dir , parcels , } ) }
Returns a new StandaloneRead constructed using the given base path and bindle ID.
Returns a new StandaloneRead constructed using the given base path and bindle ID .
base_path
P
bindle_id
I
base_path
P
bindle_id
I
#[tokio::main]
None
async fn main() {
None
}
None