pub enum ReferenceOrPath {
Reference(Reference),
Path(PathBuf),
}Expand description
Represents either an OCI image reference or a path to a rootfs on disk.
This type is used to specify the source of a container’s root filesystem:
- For OCI images (e.g., “docker.io/library/ubuntu:latest”), use
Referencevariant - For local rootfs directories (e.g., “/path/to/rootfs” or “./rootfs”), use
Pathvariant
Variants§
Reference(Reference)
An OCI-compliant image reference (e.g., “docker.io/library/ubuntu:latest”). This is used when the rootfs should be pulled from a container registry.
Path(PathBuf)
A path to a rootfs directory on the local filesystem. This can be either absolute (e.g., “/path/to/rootfs”) or relative (e.g., “./rootfs”).
Trait Implementations§
Source§impl Clone for ReferenceOrPath
impl Clone for ReferenceOrPath
Source§fn clone(&self) -> ReferenceOrPath
fn clone(&self) -> ReferenceOrPath
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 ReferenceOrPath
impl Debug for ReferenceOrPath
Source§impl<'de> Deserialize<'de> for ReferenceOrPath
impl<'de> Deserialize<'de> for ReferenceOrPath
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
Source§impl Display for ReferenceOrPath
impl Display for ReferenceOrPath
Source§impl FromStr for ReferenceOrPath
impl FromStr for ReferenceOrPath
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a string into a ReferenceOrPath.
The parsing rules are:
- If the string starts with “.” or “/”, it is interpreted as a path to a local rootfs
- Otherwise, it is interpreted as an OCI image reference
§Examples
// Parse as local rootfs path
let local = ReferenceOrPath::from_str("./my-rootfs").unwrap();
let absolute = ReferenceOrPath::from_str("/var/lib/my-rootfs").unwrap();
// Parse as OCI image reference
let image = ReferenceOrPath::from_str("ubuntu:latest").unwrap();
let full = ReferenceOrPath::from_str("docker.io/library/debian:11").unwrap();Source§type Err = MicrosandboxError
type Err = MicrosandboxError
The associated error which can be returned from parsing.
Source§impl Into<String> for ReferenceOrPath
impl Into<String> for ReferenceOrPath
Source§impl PartialEq for ReferenceOrPath
impl PartialEq for ReferenceOrPath
Source§impl Serialize for ReferenceOrPath
impl Serialize for ReferenceOrPath
Source§impl TryFrom<String> for ReferenceOrPath
impl TryFrom<String> for ReferenceOrPath
impl Eq for ReferenceOrPath
impl StructuralPartialEq for ReferenceOrPath
Auto Trait Implementations§
impl Freeze for ReferenceOrPath
impl RefUnwindSafe for ReferenceOrPath
impl Send for ReferenceOrPath
impl Sync for ReferenceOrPath
impl Unpin for ReferenceOrPath
impl UnwindSafe for ReferenceOrPath
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