Skip to main content

PackageManifest

Struct PackageManifest 

Source
pub struct PackageManifest(/* private fields */);

Implementations§

Source§

impl PackageManifest

Source

pub const META_FAR_BLOB_PATH: &'static str = "meta/"

Blob path used in package manifests to indicate the meta.far.

Source

pub fn blobs(&self) -> &[BlobInfo]

Return a reference vector of blobs in this PackageManifest.

NB: Does not include blobs referenced by possible subpackages.

Source

pub fn subpackages(&self) -> &[SubpackageInfo]

Returns a reference vector of SubpackageInfo in this PackageManifest.

Source

pub fn into_blobs(self) -> Vec<BlobInfo>

Returns a vector of the blobs in the current PackageManifest.

Source

pub fn into_blobs_and_subpackages(self) -> (Vec<BlobInfo>, Vec<SubpackageInfo>)

Returns a tuple of the current PackageManifest’s blobs and subpackages. blobs does not include blobs referenced by the subpackages.

Source

pub fn name(&self) -> &PackageName

Returns the name from the PackageMetadata.

Source

pub fn set_name(&mut self, name: PackageName)

Sets the name of the package.

Source

pub async fn archive( self, root_dir: impl AsRef<Path>, out: impl Write, ) -> Result<(), PackageManifestError>

Write a package archive into the out file. The source files are relative to the root_dir directory.

Source

pub fn package_path(&self) -> PackagePath

Returns a PackagePath formatted from the metadata of the PackageManifest.

Source

pub fn repository(&self) -> Option<&str>

Source

pub fn set_repository(&mut self, repository: Option<String>)

Source

pub fn package_url(&self) -> Result<Option<UnpinnedAbsolutePackageUrl>>

Source

pub fn hash(&self) -> Hash

Returns the merkle root of the meta.far.

§Panics

Panics if the PackageManifest is missing a “meta/” entry

Source

pub fn abi_revision(&self) -> Option<AbiRevision>

Source

pub fn delivery_blob_type(&self) -> Option<DeliveryBlobType>

Source

pub fn from_blobs_dir( blobs_dir_root: &Path, delivery_blob_type: Option<DeliveryBlobType>, meta_far_hash: Hash, out_manifest_dir: &Path, ) -> Result<Self, PackageManifestError>

Create a PackageManifest and populate a manifest directory given a blobs directory and the top level meta.far hash.

The blobs_dir_root directory must contain all the package blobs either uncompressed in root, or delivery blobs in a sub directory.

The out_manifest_dir will be a flat file populated with JSON representations of PackageManifests corresponding to the subpackages.

Source

pub fn from_archive( archive_path: &Path, blobs_dir: &Path, out_manifest_dir: &Path, ) -> Result<Self, PackageManifestError>

Extract the package blobs from archive_path into the blobs_dir directory and extracts all the JSON representations of the subpackages’ PackageManifests and top level PackageManifest into out_manifest_dir.

Returns an in-memory PackageManifest for these files.

Source

pub fn try_load_from(manifest_path: impl AsRef<Utf8Path>) -> Result<Self>

Source

pub fn from_reader( manifest_path: impl AsRef<Utf8Path>, reader: impl Read, ) -> Result<Self>

Source

pub fn package_and_subpackage_blobs( self, ) -> Result<(BlobInfo, HashMap<Hash, BlobInfo>), PackageManifestError>

Returns a tuple of a BlobInfo corresponding to the top level meta.far blob and a HashMap containing all of the blobs (both content blobs and meta.fars) from the transitive closure of the subpackages. The HashMap will not contain the BlobInfo of the top level meta.far.

Source

pub fn write_with_relative_paths( self, path: impl AsRef<Utf8Path>, ) -> Result<Self>

Source

pub fn write(&self, path: impl AsRef<Utf8Path>) -> Result<()>

Trait Implementations§

Source§

impl Clone for PackageManifest

Source§

fn clone(&self) -> PackageManifest

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PackageManifest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for PackageManifest

Source§

fn eq(&self, other: &PackageManifest) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for PackageManifest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for PackageManifest

Source§

impl StructuralPartialEq for PackageManifest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V