pub struct Package {
pub base_directory: PathBuf,
pub programs: Vec<Program>,
pub manifest: Manifest,
pub env: Env,
}
Expand description
A Leo package.
Fields§
§base_directory: PathBuf
The directory on the filesystem where the package is located, canonicalized.
programs: Vec<Program>
A topologically sorted list of all programs in this package, whether dependencies or the main program.
Any program’s dependent program will appear before it, so that compiling them in order should give access to all stubs necessary to compile each program.
manifest: Manifest
The manifest file of this package.
env: Env
The .env file of this package.
Implementations§
Source§impl Package
impl Package
pub fn outputs_directory(&self) -> PathBuf
pub fn imports_directory(&self) -> PathBuf
pub fn build_directory(&self) -> PathBuf
pub fn source_directory(&self) -> PathBuf
pub fn tests_directory(&self) -> PathBuf
Sourcepub fn initialize<P: AsRef<Path>>(
package_name: &str,
path: P,
network: NetworkName,
endpoint: &str,
) -> Result<PathBuf>
pub fn initialize<P: AsRef<Path>>( package_name: &str, path: P, network: NetworkName, endpoint: &str, ) -> Result<PathBuf>
Create a Leo package by the name package_name
in a subdirectory of path
.
fn initialize_impl( package_name: &str, path: &Path, network: NetworkName, endpoint: &str, ) -> Result<PathBuf>
Sourcepub fn from_directory_no_graph<P: AsRef<Path>, Q: AsRef<Path>>(
path: P,
home_path: Q,
) -> Result<Self>
pub fn from_directory_no_graph<P: AsRef<Path>, Q: AsRef<Path>>( path: P, home_path: Q, ) -> Result<Self>
Examine the Leo package at path
to create a Package
, but don’t find dependencies.
This may be useful if you just need other information like the manifest or env file.
Sourcepub fn from_directory<P: AsRef<Path>, Q: AsRef<Path>>(
path: P,
home_path: Q,
no_cache: bool,
) -> Result<Self>
pub fn from_directory<P: AsRef<Path>, Q: AsRef<Path>>( path: P, home_path: Q, no_cache: bool, ) -> Result<Self>
Examine the Leo package at path
to create a Package
, including all its dependencies,
obtaining dependencies from the file system or network and topologically sorting them.
Sourcepub fn from_directory_with_tests<P: AsRef<Path>, Q: AsRef<Path>>(
path: P,
home_path: Q,
no_cache: bool,
) -> Result<Self>
pub fn from_directory_with_tests<P: AsRef<Path>, Q: AsRef<Path>>( path: P, home_path: Q, no_cache: bool, ) -> Result<Self>
Examine the Leo package at path
to create a Package
, including all its dependencies
and its tests, obtaining dependencies from the file system or network and topologically sorting them.
pub fn test_files(&self) -> impl Iterator<Item = PathBuf>
pub fn import_files(&self) -> impl Iterator<Item = PathBuf>
fn files_with_extension( path: &Path, extension: &'static str, ) -> impl Iterator<Item = PathBuf>
fn from_directory_impl( path: &Path, home_path: &Path, build_graph: bool, with_tests: bool, no_cache: bool, ) -> Result<Self>
fn graph_build( home_path: &Path, network: NetworkName, endpoint: &str, main_program: &Dependency, new: Dependency, map: &mut IndexMap<Symbol, (Dependency, Program)>, graph: &mut DiGraph<Symbol>, no_cache: bool, ) -> Result<()>
Sourcepub fn get_programs_and_manifests<P: AsRef<Path>>(
&self,
home_path: P,
) -> Result<Vec<(String, String, Option<Manifest>)>>
pub fn get_programs_and_manifests<P: AsRef<Path>>( &self, home_path: P, ) -> Result<Vec<(String, String, Option<Manifest>)>>
Get the program ID, program, and optional manifest for all programs in the package.
This method assumes that the package has already been built (leo build
has been run).
fn get_programs_and_manifests_impl( &self, home_path: &Path, ) -> Result<Vec<(String, String, Option<Manifest>)>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Package
impl RefUnwindSafe for Package
impl Send for Package
impl Sync for Package
impl Unpin for Package
impl UnwindSafe for Package
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more