pub enum PathPair {
Distinct {
host: Utf8UnixPathBuf,
guest: Utf8UnixPathBuf,
},
Same(Utf8UnixPathBuf),
}Expand description
Represents a path mapping between host and guest systems, following Docker’s volume mapping convention.
§Format
The path pair can be specified in two formats:
host:guest- Maps a host path to a different guest path (e.g., “/host/path:/container/path”)pathorpath:path- Maps the same path on both host and guest (e.g., “/data” or “/data:/data”)
§Examples
Creating path pairs:
use microsandbox_core::config::PathPair;
use typed_path::Utf8UnixPathBuf;
// Same path on host and guest (/data:/data)
let same_path = PathPair::with_same("/data".into());
// Different paths (host /host/data maps to guest /container/data)
let distinct_paths = PathPair::with_distinct(
"/host/data".into(),
"/container/data".into()
);
// Parse from string
let from_str = "/host/data:/container/data".parse::<PathPair>().unwrap();
assert_eq!(from_str, distinct_paths);Variants§
Distinct
The guest path and host path are distinct.
Same(Utf8UnixPathBuf)
The guest path and host path are the same.
Implementations§
Source§impl PathPair
impl PathPair
Sourcepub fn with_same(path: Utf8UnixPathBuf) -> Self
pub fn with_same(path: Utf8UnixPathBuf) -> Self
Creates a new PathPair with the same host and guest path.
Sourcepub fn with_distinct(host: Utf8UnixPathBuf, guest: Utf8UnixPathBuf) -> Self
pub fn with_distinct(host: Utf8UnixPathBuf, guest: Utf8UnixPathBuf) -> Self
Creates a new PathPair with distinct host and guest paths.
Sourcepub fn get_host(&self) -> &Utf8UnixPathBuf
pub fn get_host(&self) -> &Utf8UnixPathBuf
Returns the host path.
Sourcepub fn get_guest(&self) -> &Utf8UnixPathBuf
pub fn get_guest(&self) -> &Utf8UnixPathBuf
Returns the guest path.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PathPair
impl<'de> Deserialize<'de> for PathPair
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for PathPair
impl StructuralPartialEq for PathPair
Auto Trait Implementations§
impl Freeze for PathPair
impl RefUnwindSafe for PathPair
impl Send for PathPair
impl Sync for PathPair
impl Unpin for PathPair
impl UnwindSafe for PathPair
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
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