pub struct DamlPackages { /* private fields */ }Expand description
Convenience methods for working with a collection of DamlPackage.
In the following example a DamlPackages is created from all known DamlPackage on a Daml ledger and then
converted into DarFile using the ArchiveAutoNamingStyle::Uuid naming style:
let ledger_client = DamlGrpcClientBuilder::uri("http://127.0.0.1").connect().await.unwrap();
let packages = DamlPackages::from_ledger(&ledger_client).await.unwrap();
let dar = packages.into_dar(ArchiveAutoNamingStyle::Uuid).unwrap();Implementations§
Source§impl DamlPackages
impl DamlPackages
pub fn new(packages: Vec<DamlPackage>) -> Self
Sourcepub async fn from_ledger(ledger_client: &DamlGrpcClient) -> DamlResult<Self>
pub async fn from_ledger(ledger_client: &DamlGrpcClient) -> DamlResult<Self>
Create a DamlPackages from all known DamlPackage on a Daml ledger.
Sourcepub async fn find_module(self, module_name: &str) -> DamlResult<String>
pub async fn find_module(self, module_name: &str) -> DamlResult<String>
Return the hash of the DamlPackage which contains a given module or en error if no such package exists.
The supplied module_name name is assumed to be in DottedName format, i.e. TopModule.SubModule.Module.
Sourcepub fn into_dar(
self,
auto_naming_style: ArchiveAutoNamingStyle,
) -> DamlResult<DarFile>
pub fn into_dar( self, auto_naming_style: ArchiveAutoNamingStyle, ) -> DamlResult<DarFile>
Package all contained DamlPackage into a single DarFile.
Note that an arbitrary package is selected as the main and the remainder are the dependencies. No attempt is made to ensure that the dependencies do in fact depend on the main.
Sourcepub fn into_archives(
self,
auto_naming_style: ArchiveAutoNamingStyle,
) -> DamlResult<Vec<DamlLfArchive>>
pub fn into_archives( self, auto_naming_style: ArchiveAutoNamingStyle, ) -> DamlResult<Vec<DamlLfArchive>>
Convert all contained DamlPackage into DamlLfArchive.
Note that the created archive is not named.
Sourcepub fn into_payloads(self) -> DamlResult<Vec<(String, DamlLfArchivePayload)>>
pub fn into_payloads(self) -> DamlResult<Vec<(String, DamlLfArchivePayload)>>
Convert all contained DamlPackage into DamlLfArchivePayload.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DamlPackages
impl RefUnwindSafe for DamlPackages
impl Send for DamlPackages
impl Sync for DamlPackages
impl Unpin for DamlPackages
impl UnwindSafe for DamlPackages
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request