pub struct StorageRoots { /* private fields */ }Expand description
Optional roots used to resolve logical input and output paths.
Relative paths are joined to their corresponding root. Absolute paths are
always treated as explicit locations and bypass the roots. Relative paths
containing .. are rejected so a logical dataset path cannot escape its
configured root.
Implementations§
Source§impl StorageRoots
impl StorageRoots
Sourcepub const fn new(
input_root: Option<PathBuf>,
output_root: Option<PathBuf>,
) -> Self
pub const fn new( input_root: Option<PathBuf>, output_root: Option<PathBuf>, ) -> Self
Creates a root mapping. Either root may be omitted.
Sourcepub fn input_root(&self) -> Option<&Path>
pub fn input_root(&self) -> Option<&Path>
Returns the configured input root, if any.
Sourcepub fn output_root(&self) -> Option<&Path>
pub fn output_root(&self) -> Option<&Path>
Returns the configured output root, if any.
Sourcepub fn resolve_input(&self, path: impl AsRef<Path>) -> Result<PathBuf, IoError>
pub fn resolve_input(&self, path: impl AsRef<Path>) -> Result<PathBuf, IoError>
Resolves a logical input path against the configured input root.
Sourcepub fn resolve_output(&self, path: impl AsRef<Path>) -> Result<PathBuf, IoError>
pub fn resolve_output(&self, path: impl AsRef<Path>) -> Result<PathBuf, IoError>
Resolves a logical output path against the configured output root.
Sourcepub fn ensure_output_parent(
&self,
path: impl AsRef<Path>,
) -> Result<(), IoError>
pub fn ensure_output_parent( &self, path: impl AsRef<Path>, ) -> Result<(), IoError>
Creates the parent directory for an explicit output path when needed.
Sourcepub fn preflight_output(
&self,
required_free_bytes: u64,
) -> Result<StoragePreflight, IoError>
pub fn preflight_output( &self, required_free_bytes: u64, ) -> Result<StoragePreflight, IoError>
Checks the configured output root before opening an external data source.
Trait Implementations§
Source§impl Clone for StorageRoots
impl Clone for StorageRoots
Source§fn clone(&self) -> StorageRoots
fn clone(&self) -> StorageRoots
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 StorageRoots
impl Debug for StorageRoots
Source§impl Default for StorageRoots
impl Default for StorageRoots
Source§fn default() -> StorageRoots
fn default() -> StorageRoots
Returns the “default value” for a type. Read more
Source§impl PartialEq for StorageRoots
impl PartialEq for StorageRoots
Source§fn eq(&self, other: &StorageRoots) -> bool
fn eq(&self, other: &StorageRoots) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for StorageRoots
impl StructuralPartialEq for StorageRoots
Auto Trait Implementations§
impl Freeze for StorageRoots
impl RefUnwindSafe for StorageRoots
impl Send for StorageRoots
impl Sync for StorageRoots
impl Unpin for StorageRoots
impl UnsafeUnpin for StorageRoots
impl UnwindSafe for StorageRoots
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