pub struct DarManifest { /* private fields */ }Expand description
Represents a manifest file found inside dar files.
A dar manifest file contains the following fields:
Manifest-Version: the version of the manifest file (optional, defaults toUnknown)Created-By: describes what created thedarfile containing this manifest file (optional, default to empty string)Main-Dalf: the name of themaindalffile within thedarfile (mandatory)Dalfs: a comma separated list ofdalffiles within thisdarfile (mandatory)Format: the format of thedalffiles in thisdararchive (mandatory)Encryption: the encryption type of thedalffiles in thisdararchive (mandatory)
Note that the main dalf file MUST also be provided in the Dalfs attribute and so that attribute will never
be empty.
Implementations§
Source§impl DarManifest
impl DarManifest
Sourcepub fn new(
version: impl Into<DarManifestVersion>,
created_by: impl Into<String>,
dalf_main: impl Into<String>,
dalf_dependencies: Vec<String>,
format: impl Into<DarManifestFormat>,
encryption: impl Into<DarEncryptionType>,
) -> Self
pub fn new( version: impl Into<DarManifestVersion>, created_by: impl Into<String>, dalf_main: impl Into<String>, dalf_dependencies: Vec<String>, format: impl Into<DarManifestFormat>, encryption: impl Into<DarEncryptionType>, ) -> Self
Crate a DarManifest.
Sourcepub fn new_implied(
dalf_main: impl Into<String>,
dalf_dependencies: Vec<String>,
) -> Self
pub fn new_implied( dalf_main: impl Into<String>, dalf_dependencies: Vec<String>, ) -> Self
Create a DarManifest from the supplied main and dalf_dependencies dalf files.
Sourcepub fn parse(manifest: &str) -> DamlLfResult<Self>
pub fn parse(manifest: &str) -> DamlLfResult<Self>
Create a DarManifest from the supplied manifest string.
Note that all dalf names are stripped of all whitespace.
§Errors
If the provided manifest string cannot be parsed into newline key: value pairs then IoError will be
returned.
If the parsed manifest has an invalid format (such as missing a mandatory key) then DarParseError will
be returned.
§Examples
let manifest_str = "
Main-Dalf: A.dalf
Dalfs: A.dalf
Format: daml-lf
Encryption: non-encrypted";
let manifest = DarManifest::parse(&manifest_str[..])?;
assert_eq!(DarManifestVersion::Unknown, manifest.version());
assert_eq!("", manifest.created_by());
assert_eq!("A.dalf", manifest.dalf_main());
assert_eq!(&Vec::<String>::new(), manifest.dalf_dependencies());
assert_eq!(DarManifestFormat::DamlLf, manifest.format());
assert_eq!(DarEncryptionType::NotEncrypted, manifest.encryption());Sourcepub const fn version(&self) -> DarManifestVersion
pub const fn version(&self) -> DarManifestVersion
The version of the manifest.
Sourcepub fn created_by(&self) -> &str
pub fn created_by(&self) -> &str
Describes who created the dar file which contains this manifest file.
Sourcepub fn dalf_main(&self) -> &str
pub fn dalf_main(&self) -> &str
The name of the main dalf archive within the dar file containing this manifest file.
Sourcepub const fn dalf_dependencies(&self) -> &Vec<String>
pub const fn dalf_dependencies(&self) -> &Vec<String>
A list of names of the dalf_dependencies dalf archives within the dar file containing this manifest file.
Sourcepub const fn format(&self) -> DarManifestFormat
pub const fn format(&self) -> DarManifestFormat
The format of the dar which contains this manifest file.
Sourcepub const fn encryption(&self) -> DarEncryptionType
pub const fn encryption(&self) -> DarEncryptionType
The encryption type of the dar which contains this manifest file.
Trait Implementations§
Source§impl Clone for DarManifest
impl Clone for DarManifest
Source§fn clone(&self) -> DarManifest
fn clone(&self) -> DarManifest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DarManifest
impl RefUnwindSafe for DarManifest
impl Send for DarManifest
impl Sync for DarManifest
impl Unpin for DarManifest
impl UnwindSafe for DarManifest
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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