pub struct CompilationUnit {
pub name: Symbol,
pub data: ProgramData,
pub edition: Option<u16>,
pub dependencies: IndexSet<Dependency>,
pub is_local: bool,
pub kind: PackageKind,
}Expand description
Information about a single Leo compilation unit.
Fields§
§name: Symbol§data: ProgramData§edition: Option<u16>§dependencies: IndexSet<Dependency>§is_local: bool§kind: PackageKindImplementations§
Source§impl CompilationUnit
impl CompilationUnit
Sourcepub fn from_aleo_path<P: AsRef<Path>>(
name: Symbol,
path: P,
map: &IndexMap<Symbol, Dependency>,
) -> Result<Self>
pub fn from_aleo_path<P: AsRef<Path>>( name: Symbol, path: P, map: &IndexMap<Symbol, Dependency>, ) -> Result<Self>
Given the location path of a .aleo file, read the filesystem
to obtain a CompilationUnit.
Sourcepub fn from_package_path<P: AsRef<Path>>(name: Symbol, path: P) -> Result<Self>
pub fn from_package_path<P: AsRef<Path>>(name: Symbol, path: P) -> Result<Self>
Given the location path of a local Leo package, read the filesystem
to obtain a CompilationUnit.
Sourcepub fn from_test_path<P: AsRef<Path>>(
source_path: P,
main_program: Dependency,
) -> Result<Self>
pub fn from_test_path<P: AsRef<Path>>( source_path: P, main_program: Dependency, ) -> Result<Self>
Given the path to the source file of a test, create a CompilationUnit.
Unlike CompilationUnit::from_package_path, the path is to the source file,
and the name of the program is determined from the filename.
main_program must be provided since every test is dependent on it.
Sourcepub fn fetch<P: AsRef<Path>>(
name: Symbol,
edition: Option<u16>,
home_path: P,
network: NetworkName,
endpoint: &str,
no_cache: bool,
network_retries: u32,
) -> Result<Self>
pub fn fetch<P: AsRef<Path>>( name: Symbol, edition: Option<u16>, home_path: P, network: NetworkName, endpoint: &str, no_cache: bool, network_retries: u32, ) -> Result<Self>
Given an Aleo program on a network, fetch it to build a CompilationUnit.
If no edition is found, the latest edition is pulled from the network.
Trait Implementations§
Source§impl Clone for CompilationUnit
impl Clone for CompilationUnit
Source§fn clone(&self) -> CompilationUnit
fn clone(&self) -> CompilationUnit
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CompilationUnit
impl RefUnwindSafe for CompilationUnit
impl Send for CompilationUnit
impl Sync for CompilationUnit
impl Unpin for CompilationUnit
impl UnsafeUnpin for CompilationUnit
impl UnwindSafe for CompilationUnit
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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