pub fn mount(
arg: &str,
filesystem: Arc<dyn FileSystem>,
) -> Result<(), MappingError>Expand description
Mounts a given filesystem at the specified path.
This function allows mounting a new filesystem at a specific path within the virtual filesystem. If the path is “/”, the provided filesystem becomes the root filesystem (if not already mounted). If the path is not “/”, the provided filesystem is mounted as a child of the filesystem at the specified path.
§Parameters
-
arg: A reference to a string representing the path where the filesystem should be mounted. The path must be absolute and not contain any “..” or “.” components. -
filesystem: AnArcsmart pointer to a trait object implementing theFileSystemtrait. This trait defines the behavior of the filesystem to be mounted.
§Returns
-
Ok(()): If the filesystem is successfully mounted at the specified path. -
Err(MappingError): If an error occurs during the mounting process. The specific error can be one of the following:MappingError::MustBeAbsolute: If the provided path is not absolute.MappingError::InvalidPath: If the provided path contains “..” or “.” components.MappingError::PartOfParentNotMounted: If the parent path of the provided path is not mounted.MappingError::AlreadyMounted: If the provided path is already mounted.