pub struct ParsedMount {
pub host_path: PathBuf,
pub container_path: String,
pub read_only: bool,
}Expand description
A parsed bind mount specification.
Fields§
§host_path: PathBufHost path to mount (absolute).
container_path: StringContainer path where the host path is mounted.
read_only: boolWhether the mount is read-only.
Implementations§
Source§impl ParsedMount
impl ParsedMount
Sourcepub fn parse(mount_str: &str) -> Result<Self, MountError>
pub fn parse(mount_str: &str) -> Result<Self, MountError>
Parse a mount string in Docker format.
Format: /host/path:/container/path[:ro|rw]
§Arguments
mount_str- The mount specification string.
§Returns
Ok(ParsedMount)- Successfully parsed mount.Err(MountError)- Parse error.
§Examples
use opencode_cloud_core::docker::ParsedMount;
// Read-write mount (default)
let mount = ParsedMount::parse("/home/user/data:/workspace/data").unwrap();
assert_eq!(mount.host_path.to_str().unwrap(), "/home/user/data");
assert_eq!(mount.container_path, "/workspace/data");
assert!(!mount.read_only);
// Read-only mount
let mount = ParsedMount::parse("/home/user/config:/etc/app:ro").unwrap();
assert!(mount.read_only);Sourcepub fn to_bollard_mount(&self) -> Mount
pub fn to_bollard_mount(&self) -> Mount
Convert to a Bollard Mount for the Docker API.
Returns a bind mount with the parsed host and container paths.
Trait Implementations§
Source§impl Clone for ParsedMount
impl Clone for ParsedMount
Source§fn clone(&self) -> ParsedMount
fn clone(&self) -> ParsedMount
Returns a duplicate 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 ParsedMount
impl Debug for ParsedMount
Source§impl PartialEq for ParsedMount
impl PartialEq for ParsedMount
impl StructuralPartialEq for ParsedMount
Auto Trait Implementations§
impl Freeze for ParsedMount
impl RefUnwindSafe for ParsedMount
impl Send for ParsedMount
impl Sync for ParsedMount
impl Unpin for ParsedMount
impl UnwindSafe for ParsedMount
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<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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request