pub async fn pack<M: Manifest>(
    dir_path: &std::path::Path,
    target_path: Option<PathBuf>,
    name: String,
) -> AinBundleResult<(PathBuf, Bundle<M>)> {
    let dir_path = ffs::canonicalize(dir_path).await?;
    let manifest_path = dir_path.join(&M::path());
    let bundle: Bundle<M> = Bundle::pack_yaml(&manifest_path).await?;
    let target_path = match target_path {
        Some(target_path) => {
            if target_path.is_dir() {
                dir_to_bundle_path(&target_path, name, M::bundle_extension())?
            } else {
                target_path
            }
        }
        None => dir_to_bundle_path(&dir_path, name, M::bundle_extension())?,
    };
    bundle.write_to_file(&target_path).await?;
    Ok((target_path, bundle))
}
/// Pack a directory containing a SAF manifest into a SafBundle, returning
/// the path to which the bundle file was written
Pack a directory containing a SAF manifest into a SafBundle, returning
the path to which the bundle file was written
Pack a directory containing a SAF manifest into a SafBundle returning the path to which the bundle file was written
pub async fn pack<M: Manifest>(
    dir_path: &std::path::Path,
    target_path: Option<PathBuf>,
    name: String,
) -> AinBundleResult<(PathBuf, Bundle<M>)> {
    let dir_path = ffs::canonicalize(dir_path).await?;
    let manifest_path = dir_path.join(&M::path());
    let bundle: Bundle<M> = Bundle::pack_yaml(&manifest_path).await?;
    let target_path = match target_path {
        Some(target_path) => {
            if target_path.is_dir() {
                dir_to_bundle_path(&target_path, name, M::bundle_extension())?
            } else {
                target_path
            }
        }
        None => dir_to_bundle_path(&dir_path, name, M::bundle_extension())?,
    };
    bundle.write_to_file(&target_path).await?;
    Ok((target_path, bundle))
}
pub async fn pack < M : Manifest > ( dir_path : & std :: path :: Path , target_path : Option < PathBuf > , name : String , ) -> AinBundleResult < ( PathBuf , Bundle < M > ) > { let dir_path = ffs :: canonicalize ( dir_path ) . await ? ; let manifest_path = dir_path . join ( & M :: path ( ) ) ; let bundle : Bundle < M > = Bundle :: pack_yaml ( & manifest_path ) . await ? ; let target_path = match target_path { Some ( target_path ) => { if target_path . is_dir ( ) { dir_to_bundle_path ( & target_path , name , M :: bundle_extension ( ) ) ? } else { target_path } } None => dir_to_bundle_path ( & dir_path , name , M :: bundle_extension ( ) ) ? , } ; bundle . write_to_file ( & target_path ) . await ? ; Ok ( ( target_path , bundle ) ) }
Pack a directory containing a SAF manifest into a SafBundle, returning
the path to which the bundle file was written
Pack a directory containing a SAF manifest into a SafBundle returning the path to which the bundle file was written
dir_path
&std::path::Path
target_path
Option<PathBuf>
name
String
dir_path
&std::path::Path
target_path
Option<PathBuf>
name
String