pub enum AssetLocation {
Url(Url),
FilePath(PathBuf),
}
Expand description
A location for a locally or remotely stored asset.
It can be constructed from an url::Url
, a std::path::PathBuf
or an &str
.
§Examples:
use url::Url;
use std::{path::PathBuf, str::FromStr};
use zombienet_configuration::shared::types::AssetLocation;
let url_location: AssetLocation = Url::from_str("https://mycloudstorage.com/path/to/my/file.tgz").unwrap().into();
let url_location2: AssetLocation = "https://mycloudstorage.com/path/to/my/file.tgz".into();
let path_location: AssetLocation = PathBuf::from_str("/tmp/path/to/my/file").unwrap().into();
let path_location2: AssetLocation = "/tmp/path/to/my/file".into();
assert!(matches!(url_location, AssetLocation::Url(value) if value.as_str() == "https://mycloudstorage.com/path/to/my/file.tgz"));
assert!(matches!(url_location2, AssetLocation::Url(value) if value.as_str() == "https://mycloudstorage.com/path/to/my/file.tgz"));
assert!(matches!(path_location, AssetLocation::FilePath(value) if value.to_str().unwrap() == "/tmp/path/to/my/file"));
assert!(matches!(path_location2, AssetLocation::FilePath(value) if value.to_str().unwrap() == "/tmp/path/to/my/file"));
Variants§
Implementations§
Trait Implementations§
source§impl Clone for AssetLocation
impl Clone for AssetLocation
source§fn clone(&self) -> AssetLocation
fn clone(&self) -> AssetLocation
Returns a copy 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 moresource§impl Debug for AssetLocation
impl Debug for AssetLocation
source§impl<'de> Deserialize<'de> for AssetLocation
impl<'de> Deserialize<'de> for AssetLocation
source§fn deserialize<D>(deserializer: D) -> Result<AssetLocation, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<AssetLocation, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for AssetLocation
impl Display for AssetLocation
source§impl From<&str> for AssetLocation
impl From<&str> for AssetLocation
source§impl From<PathBuf> for AssetLocation
impl From<PathBuf> for AssetLocation
source§impl From<Url> for AssetLocation
impl From<Url> for AssetLocation
source§impl PartialEq for AssetLocation
impl PartialEq for AssetLocation
source§impl Serialize for AssetLocation
impl Serialize for AssetLocation
impl StructuralPartialEq for AssetLocation
Auto Trait Implementations§
impl Freeze for AssetLocation
impl RefUnwindSafe for AssetLocation
impl Send for AssetLocation
impl Sync for AssetLocation
impl Unpin for AssetLocation
impl UnwindSafe for AssetLocation
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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>
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