Skip to main content

VfsExtension

Trait VfsExtension 

Source
pub trait VfsExtension:
    Send
    + Sync
    + 'static {
    type Request: Serialize + for<'de> Deserialize<'de> + Send + 'static;
    type Response: Serialize + for<'de> Deserialize<'de> + Send + 'static;

    const NAME: &'static str;
    const VERSION: u16;
    const AVAILABLE: bool = true;

    // Required method
    fn handle(
        &self,
        ctx: &mut ExtContext<'_>,
        request: Self::Request,
    ) -> impl Future<Output = Self::Response> + Send;
}
Expand description

A named, versioned VFS extension and its request handler.

Implement this trait for a zero-sized extension descriptor, then register it with the vfs_extension! macro. The extension must be linked into both the caller and the server for remote dispatch.

Required Associated Constants§

Source

const NAME: &'static str

Extension name, used together with VERSION to route requests.

Source

const VERSION: u16

Extension version, used together with NAME to route requests.

Provided Associated Constants§

Source

const AVAILABLE: bool = true

Whether this process has a backend implementation for the extension.

Required Associated Types§

Source

type Request: Serialize + for<'de> Deserialize<'de> + Send + 'static

Extension request payload.

Source

type Response: Serialize + for<'de> Deserialize<'de> + Send + 'static

Extension response payload.

Required Methods§

Source

fn handle( &self, ctx: &mut ExtContext<'_>, request: Self::Request, ) -> impl Future<Output = Self::Response> + Send

Handles a single request.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§