/// Wrapper around `new`, where the path to the Cargo.toml of the canister
/// to build is given relative to `rs/`.
///
/// This can be more convenient than using `new` directly, because the path
/// given is independent of the location of the Cargo.toml of the
/// test/binary that uses it.
Wrapper around `new`, where the path to the Cargo.toml of the canister
to build is given relative to `rs/`.

This can be more convenient than using `new` directly, because the path
given is independent of the location of the Cargo.toml of the
test/binary that uses it.
Wrapper around ` new ` where the path to the Cargo . toml of the canister to build is given relative to ` rs / ` . This can be more convenient than using ` new ` directly because the path given is independent of the location of the Cargo . toml of the test / binary that uses it .
fn new_from_path_relative_to_rs(relative_path_from_rs: impl AsRef<Path>) -> Self {
        // This fn should remain private, because it will panic on CI.
        let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR").to_owned());
        let canonical = dir.canonicalize().unwrap();
        let rs = {
            let mut d = canonical.as_path();
            // TODO(VER-190) Robustify -- there could be more than one dir called 'rs'
            while !d.ends_with("rs") {
                d = d.parent().unwrap_or_else(||
                    panic!(
                        "Could not find the rs/ directory while going up from the CARGO_MANIFEST_DIR, \
                        which is {}, and got canonicalized to {}. \
                        Are you seeing this on CI? If so, then probably you're missing some \
                        entries in the canistersForTests map in rs/check.nix.",
                           dir.as_os_str().to_string_lossy(),
                           canonical.as_os_str().to_string_lossy()));
            }
            d
        };
        let crate_dir = rs.join(relative_path_from_rs);
        Self::new(crate_dir)
    }
fn new_from_path_relative_to_rs ( relative_path_from_rs : impl AsRef < Path > ) -> Self { // This fn should remain private, because it will panic on CI. let dir = PathBuf :: from ( env ! ( " " ) . to_owned ( ) ) ; let canonical = dir . canonicalize ( ) . unwrap ( ) ; let rs = { let mut d = canonical . as_path ( ) ; // TODO(VER-190) Robustify -- there could be more than one dir called 'rs' while ! d . ends_with ( " " ) { d = d . parent ( ) . unwrap_or_else ( | | panic ! ( " \
 \
 \
 " dir as_os_str ( ) to_string_lossy ( ) canonical as_os_str ( ) to_string_lossy ( ) ) ) ; } d } ; let crate_dir = rs . join ( relative_path_from_rs ) ; Self :: new ( crate_dir ) }
Wrapper around `new`, where the path to the Cargo.toml of the canister
to build is given relative to `rs/`.
Wrapper around ` new ` where the path to the Cargo . toml of the canister to build is given relative to ` rs / ` .
relative_path_from_rs
impl AsRef<Path>