pub trait VfsExt:
IsA<Vfs>
+ Sealed
+ 'static {
// Provided methods
fn file_for_path(&self, path: &str) -> File { ... }
fn file_for_uri(&self, uri: &str) -> File { ... }
fn supported_uri_schemes(&self) -> Vec<GString> { ... }
fn is_active(&self) -> bool { ... }
fn parse_name(&self, parse_name: &str) -> File { ... }
fn register_uri_scheme(
&self,
scheme: &str,
uri_func: Option<Box_<dyn Fn(&Vfs, &str) -> File + 'static>>,
parse_name_func: Option<Box_<dyn Fn(&Vfs, &str) -> File + 'static>>,
) -> bool { ... }
fn unregister_uri_scheme(&self, scheme: &str) -> bool { ... }
}
Provided Methods§
Sourcefn file_for_path(&self, path: &str) -> File
fn file_for_path(&self, path: &str) -> File
Sourcefn file_for_uri(&self, uri: &str) -> File
fn file_for_uri(&self, uri: &str) -> File
Sourcefn supported_uri_schemes(&self) -> Vec<GString>
fn supported_uri_schemes(&self) -> Vec<GString>
Sourcefn parse_name(&self, parse_name: &str) -> File
fn parse_name(&self, parse_name: &str) -> File
Sourcefn register_uri_scheme(
&self,
scheme: &str,
uri_func: Option<Box_<dyn Fn(&Vfs, &str) -> File + 'static>>,
parse_name_func: Option<Box_<dyn Fn(&Vfs, &str) -> File + 'static>>,
) -> bool
fn register_uri_scheme( &self, scheme: &str, uri_func: Option<Box_<dyn Fn(&Vfs, &str) -> File + 'static>>, parse_name_func: Option<Box_<dyn Fn(&Vfs, &str) -> File + 'static>>, ) -> bool
Registers @uri_func and @parse_name_func as the #GFile URI and parse name lookup functions for URIs with a scheme matching @scheme. Note that @scheme is registered only within the running application, as opposed to desktop-wide as it happens with GVfs backends.
When a #GFile is requested with an URI containing @scheme (e.g. through g_file_new_for_uri()), @uri_func will be called to allow a custom constructor. The implementation of @uri_func should not be blocking, and must not call g_vfs_register_uri_scheme() or g_vfs_unregister_uri_scheme().
When g_file_parse_name() is called with a parse name obtained from such file, @parse_name_func will be called to allow the #GFile to be created again. In that case, it’s responsibility of @parse_name_func to make sure the parse name matches what the custom #GFile implementation returned when g_file_get_parse_name() was previously called. The implementation of @parse_name_func should not be blocking, and must not call g_vfs_register_uri_scheme() or g_vfs_unregister_uri_scheme().
It’s an error to call this function twice with the same scheme. To unregister a custom URI scheme, use g_vfs_unregister_uri_scheme().
§scheme
an URI scheme, e.g. “http”
§uri_func
a #GVfsFileLookupFunc
§uri_data
custom data passed to be passed to @uri_func, or None
§uri_destroy
function to be called when unregistering the URI scheme, or when @self is disposed, to free the resources used by the URI lookup function
§parse_name_func
a #GVfsFileLookupFunc
§parse_name_data
custom data passed to be passed to
@parse_name_func, or None
§parse_name_destroy
function to be called when unregistering the URI scheme, or when @self is disposed, to free the resources used by the parse name lookup function
§Returns
true
if @scheme was successfully registered, or false
if a handler
for @scheme already exists.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.