Struct cw_orch_core::contract::ArtifactsDir
source · pub struct ArtifactsDir(/* private fields */);
Expand description
Points to a directory containing WASM files
§Example
use cw_orch_core::contract::{ArtifactsDir, WasmPath};
// Get the artifacts directory from the environment variable `ARTIFACTS_DIR`.
let artifact_dir = ArtifactsDir::env();
// Or create a new one.
let artifact_dir = ArtifactsDir::new("path/to/artifacts");
// Get a path to a WASM file that contains the string "my_contract".
let wasm_path: WasmPath = artifact_dir.find_wasm_path("my_contract").unwrap();
Implementations§
source§impl ArtifactsDir
impl ArtifactsDir
sourcepub fn auto(start_path: Option<String>) -> Self
pub fn auto(start_path: Option<String>) -> Self
Creates an artifacts dir by searching for an artifacts directory by going up the file tree from start_path or the current directory
sourcepub fn new(path: impl Into<PathBuf>) -> Self
pub fn new(path: impl Into<PathBuf>) -> Self
Create a new ArtifactsDir from a path to a directory containing WASM files.
sourcepub fn find_wasm_path(&self, name: &str) -> Result<WasmPath, CwEnvError>
pub fn find_wasm_path(&self, name: &str) -> Result<WasmPath, CwEnvError>
Find a WASM file in the artifacts directory that contains the given name.
sourcepub fn find_wasm_path_with_build_postfix(
&self,
name: &str,
build_postfix: BuildPostfix<'_>,
) -> Result<WasmPath, CwEnvError>
pub fn find_wasm_path_with_build_postfix( &self, name: &str, build_postfix: BuildPostfix<'_>, ) -> Result<WasmPath, CwEnvError>
Find a WASM file in the artifacts directory that contains the given contract name AND build post-fix. If a build with the post-fix is not found, the default build will be used. If none of the two are found, an error is returned.
Auto Trait Implementations§
impl Freeze for ArtifactsDir
impl RefUnwindSafe for ArtifactsDir
impl Send for ArtifactsDir
impl Sync for ArtifactsDir
impl Unpin for ArtifactsDir
impl UnwindSafe for ArtifactsDir
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> 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