Trait FileSystemParams

Source
pub trait FileSystemParams {
    // Required methods
    fn to_string_map(&self) -> BTreeMap<String, String>;
    fn from_string_map(map: &BTreeMap<String, String>) -> Result<Self, String>
       where Self: Sized;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Core trait for filesystem parameter types

This trait enables type-safe filesystem configuration while maintaining backward compatibility with string-based parameter systems. All filesystem parameter structures must implement this trait to be usable with the VfsManager’s structured parameter creation methods.

§Dynamic Dispatch Support

The trait includes as_any() to enable dynamic downcasting, which supports future dynamic filesystem module loading scenarios where parameter types may not be known at compile time.

Required Methods§

Source

fn to_string_map(&self) -> BTreeMap<String, String>

Convert parameters to string map for backward compatibility

This method serializes the structured parameters into a key-value string map that can be consumed by legacy filesystem drivers that haven’t been updated to use structured parameters.

§Returns

BTreeMap containing string representations of all parameters

Source

fn from_string_map(map: &BTreeMap<String, String>) -> Result<Self, String>
where Self: Sized,

Create parameters from string map for backward compatibility

This method deserializes parameters from a string map, enabling legacy code to continue working while gradually migrating to structured parameter usage.

§Arguments
  • map - String map containing parameter key-value pairs
§Returns
  • Ok(Self) - Successfully parsed parameters
  • Err(String) - Parse error with description
Source

fn as_any(&self) -> &dyn Any

Enable dynamic downcasting for runtime type identification

This method supports dynamic dispatch scenarios where the exact parameter type is not known at compile time, such as when loading filesystem modules dynamically.

§Returns

Reference to self as Any trait object for downcasting

Implementors§