Skip to main content

Dar

Struct Dar 

Source
pub struct Dar { /* private fields */ }
Expand description

A parsed DAR: its manifest fields plus the raw bytes of each .dalf.

Implementations§

Source§

impl Dar

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, DarError>

Read a DAR from a file on disk.

§Errors

Returns DarError if the file cannot be read or is not a valid DAR.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, DarError>

Read a DAR from an in-memory byte buffer.

§Errors

Returns DarError if the bytes are not a valid DAR.

Source

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

The package name (manifest Name), if present.

Source

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

The Daml SDK version the DAR was built with (manifest Sdk-Version).

Source

pub fn main_package_bytes(&self) -> Result<&[u8], DarError>

The raw Daml-LF bytes of the main package (the DAR’s own package, as opposed to its daml-prim / daml-stdlib / transitive dependencies).

§Errors

Returns DarError if the manifest does not name the main package or the named entry is absent.

Source

pub fn package_paths(&self) -> impl Iterator<Item = &str>

The archive paths of every package (.dalf) in the DAR, main and dependencies, in sorted order.

Source

pub fn package_bytes(&self) -> impl Iterator<Item = &[u8]>

The raw Daml-LF bytes of every package in the DAR — the main package and its full dependency closure (daml-prim, daml-stdlib, and any other packages the DAR bundles). Decoding all of them gives the PackageMap needed to resolve cross-package references.

Source

pub fn package_entries(&self) -> impl Iterator<Item = (&str, &[u8])>

Like Self::package_bytes, each package paired with its archive path — so a decode failure can name the offending .dalf.

Source

pub fn package_count(&self) -> usize

The number of packages (.dalf entries) in the DAR.

Trait Implementations§

Source§

impl Debug for Dar

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Dar

§

impl RefUnwindSafe for Dar

§

impl Send for Dar

§

impl Sync for Dar

§

impl Unpin for Dar

§

impl UnsafeUnpin for Dar

§

impl UnwindSafe for Dar

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.