pub struct Context {
pub path: Option<PathBuf>,
pub home: Option<PathBuf>,
pub recursive: bool,
}
Expand description
Project context, manifest, current directory etc All the info that is relevant in most of the commands
Fields§
§path: Option<PathBuf>
Path at which the command is called, None when default
home: Option<PathBuf>
Path to use for the Aleo registry, None when default
recursive: bool
Recursive flag.
Implementations§
Source§impl Context
impl Context
pub fn new( path: Option<PathBuf>, home: Option<PathBuf>, recursive: bool, ) -> Result<Context>
Sourcepub fn parent_dir(&self) -> Result<PathBuf>
pub fn parent_dir(&self) -> Result<PathBuf>
Returns the path of the parent directory to the Leo package.
Sourcepub fn open_manifest<N: Network>(&self) -> Result<Manifest<N>>
pub fn open_manifest<N: Network>(&self) -> Result<Manifest<N>>
Returns the package name as a String.
Opens the manifest file program.json
and creates the build directory if it doesn’t exist.
Sourcepub fn local_dependency_paths(&self) -> Result<Vec<(String, PathBuf)>>
pub fn local_dependency_paths(&self) -> Result<Vec<(String, PathBuf)>>
Returns a post ordering of the local dependencies.
Found by reading the lock file leo.lock
.
Sourcepub fn dotenv_private_key<N: Network>(&self) -> Result<PrivateKey<N>>
pub fn dotenv_private_key<N: Network>(&self) -> Result<PrivateKey<N>>
Returns the private key from the .env file specified in the directory.
Sourcepub fn dotenv_endpoint(&self) -> Result<String>
pub fn dotenv_endpoint(&self) -> Result<String>
Returns the endpoint from the .env file specified in the directory.
Sourcepub fn dotenv_network(&self) -> Result<String>
pub fn dotenv_network(&self) -> Result<String>
Returns the network from the .env file specified in the directory.
Sourcepub fn get_endpoint(&self, endpoint: &Option<String>) -> Result<String>
pub fn get_endpoint(&self, endpoint: &Option<String>) -> Result<String>
Returns the endpoint to interact with the network.
If the --endpoint
options is not provided, it will default to the one in the .env
file.
Sourcepub fn get_network(&self, network: &Option<String>) -> Result<String>
pub fn get_network(&self, network: &Option<String>) -> Result<String>
Returns the network name.
If the --network
options is not provided, it will default to the one in the .env
file.
Sourcepub fn get_private_key<N: Network>(
&self,
private_key: &Option<String>,
) -> Result<PrivateKey<N>>
pub fn get_private_key<N: Network>( &self, private_key: &Option<String>, ) -> Result<PrivateKey<N>>
Returns the private key.
If the --private-key
options is not provided, it will default to the one in the .env
file.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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