pub struct Commander { /* private fields */ }Expand description
Commander allows you to start localnet, build programs,
run tests and do other useful operations.
Implementations§
Source§impl Commander
impl Commander
Sourcepub fn with_root(root: impl Into<Cow<'static, str>>) -> Self
pub fn with_root(root: impl Into<Cow<'static, str>>) -> Self
Creates a new Commander instance with the provided root.
Sourcepub async fn build_programs(&self) -> Result<(), Error>
pub async fn build_programs(&self) -> Result<(), Error>
Builds programs (smart contracts).
Sourcepub async fn run_tests(&self) -> Result<(), Error>
pub async fn run_tests(&self) -> Result<(), Error>
Runs standard Rust tests.
Note: The –nocapture argument is used
to allow you read println outputs in your terminal window.
Sourcepub async fn create_program_client_crate(&self) -> Result<(), Error>
pub async fn create_program_client_crate(&self) -> Result<(), Error>
Creates the program_client crate.
It’s used internally by the #[trdelnik_test] macro.
Sourcepub fn program_packages(&self) -> impl Iterator<Item = Package>
pub fn program_packages(&self) -> impl Iterator<Item = Package>
Sourcepub async fn generate_program_client_deps(&self) -> Result<(), Error>
pub async fn generate_program_client_deps(&self) -> Result<(), Error>
Updates the program_client dependencies.
It’s used internally by the #[trdelnik_test] macro.
Sourcepub async fn generate_program_client_lib_rs(&self) -> Result<(), Error>
pub async fn generate_program_client_lib_rs(&self) -> Result<(), Error>
Updates the program_client lib.rs.
It’s used internally by the #[trdelnik_test] macro.
Sourcepub async fn format_program_code(code: &str) -> Result<String, Error>
pub async fn format_program_code(code: &str) -> Result<String, Error>
Formats program code.
Sourcepub async fn start_localnet(&self) -> Result<LocalnetHandle, Error>
pub async fn start_localnet(&self) -> Result<LocalnetHandle, Error>
Starts the localnet (Solana validator).
Sourcepub async fn parse_program_client_imports(&self) -> Result<Vec<ItemUse>, Error>
pub async fn parse_program_client_imports(&self) -> Result<Vec<ItemUse>, Error>
Returns use modules / statements
The goal of this method is to find all use statements defined by the user in the .program_client
crate. It solves the problem with regenerating the program client and removing imports defined by
the user.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Commander
impl RefUnwindSafe for Commander
impl Send for Commander
impl Sync for Commander
impl Unpin for Commander
impl UnwindSafe for Commander
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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 more