Skip to main content

Function

Trait Function 

Source
pub trait Function:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn driver(&self) -> OsString;
    fn dir(&self) -> FunctionDir;
    fn register(&self) -> Result<()>;

    // Provided methods
    fn pre_removal(&self) -> Result<()> { ... }
    fn post_removal(&self, _dir: &Path) -> Result<()> { ... }
}
Expand description

USB gadget function.

Required Methods§

Source

fn driver(&self) -> OsString

Name of the function driver.

Source

fn dir(&self) -> FunctionDir

Function directory.

Source

fn register(&self) -> Result<()>

Register the function in configfs at the specified path.

Provided Methods§

Source

fn pre_removal(&self) -> Result<()>

Notifies the function that the USB gadget is about to be removed.

Source

fn post_removal(&self, _dir: &Path) -> Result<()>

Notifies the function that the USB gadget has been removed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§