pub trait Context<T: Type + ?Sized> {
type Data: ForeignOwnable + Send + Sync + 'static;
const USE_VTABLE_ATTR: ();
const HAS_TRY_NEW: bool = false;
const HAS_PARSE_UNKNOWN_PARAM: bool = false;
const HAS_PARSE_MONOLITHIC: bool = false;
const HAS_TREE_KEY: bool = false;
const PARAMS: SpecTable<'static, Self::Data> = _;
fn try_new() -> Result<Self::Data>;
fn parse_unknown_param(
_data: &mut Self::Data,
_name: &CStr,
_value: Value<'_>
) -> Result { ... }
fn parse_monolithic<'a>(
_data: &mut Self::Data,
_buf: Option<&'a mut [u8]>
) -> Result<Option<&'a mut [u8]>> { ... }
fn tree_key(_data: &mut Self::Data) -> Result<T::Data> { ... }
}
Expand description
A file system context.
It is used to gather configuration to then mount or reconfigure a file system.
Required Associated Types
sourcetype Data: ForeignOwnable + Send + Sync + 'static
type Data: ForeignOwnable + Send + Sync + 'static
Type of the data associated with the context.
Required Associated Constants
sourceconst USE_VTABLE_ATTR: ()
const USE_VTABLE_ATTR: ()
A marker to prevent implementors from forgetting to use #[vtable]
attribute when implementing this trait.
Provided Associated Constants
sourceconst HAS_TRY_NEW: bool = false
const HAS_TRY_NEW: bool = false
Indicates if the try_new
method is overridden by the implementor.
sourceconst HAS_PARSE_UNKNOWN_PARAM: bool = false
const HAS_PARSE_UNKNOWN_PARAM: bool = false
Indicates if the parse_unknown_param
method is overridden by the implementor.
sourceconst HAS_PARSE_MONOLITHIC: bool = false
const HAS_PARSE_MONOLITHIC: bool = false
Indicates if the parse_monolithic
method is overridden by the implementor.
sourceconst HAS_TREE_KEY: bool = false
const HAS_TREE_KEY: bool = false
Indicates if the tree_key
method is overridden by the implementor.
sourceconst PARAMS: SpecTable<'static, Self::Data> = _
const PARAMS: SpecTable<'static, Self::Data> = _
The typed file system parameters.
Users are encouraged to define it using the crate::define_fs_params
macro.
Required Methods
Provided Methods
sourcefn parse_unknown_param(
_data: &mut Self::Data,
_name: &CStr,
_value: Value<'_>
) -> Result
fn parse_unknown_param(
_data: &mut Self::Data,
_name: &CStr,
_value: Value<'_>
) -> Result
Parses a parameter that wasn’t specified in Self::PARAMS
.
sourcefn parse_monolithic<'a>(
_data: &mut Self::Data,
_buf: Option<&'a mut [u8]>
) -> Result<Option<&'a mut [u8]>>
fn parse_monolithic<'a>(
_data: &mut Self::Data,
_buf: Option<&'a mut [u8]>
) -> Result<Option<&'a mut [u8]>>
Parses the whole parameter block, potentially skipping regular handling for parts of it.
The return value is the portion of the input buffer for which the regular handling
(involving Self::PARAMS
and Self::parse_unknown_param
) will still be carried out.
If it’s None
, the regular handling is not performed at all.
sourcefn tree_key(_data: &mut Self::Data) -> Result<T::Data>
fn tree_key(_data: &mut Self::Data) -> Result<T::Data>
Returns the superblock data to be used by this file system context.
This is only needed when Type::SUPER_TYPE
is Super::Keyed
, otherwise it is never
called. In the former case, when the fs is being mounted, an existing superblock is reused
if one can be found with the same data as the returned value; otherwise a new superblock is
created.