pub trait ControlOps: Send + Sync {
// Provided methods
fn control(&self, command: u32, arg: usize) -> Result<i32, &'static str> { ... }
fn supported_control_commands(&self) -> Vec<(u32, &'static str)> { ... }
}Expand description
Control operations capability
This trait represents the ability to perform control operations on a resource, similar to ioctl operations in POSIX systems. Control operations allow querying and modifying device-specific settings and configurations.
Provided Methods§
Sourcefn control(&self, command: u32, arg: usize) -> Result<i32, &'static str>
fn control(&self, command: u32, arg: usize) -> Result<i32, &'static str>
Perform a control operation
§Arguments
command- The control command identifierarg- Command-specific argument (often a pointer to data)
§Returns
Result<i32, &'static str>- Command-specific return value or error
§Default Implementation
The default implementation returns an error indicating that control operations are not supported by this object.
Sourcefn supported_control_commands(&self) -> Vec<(u32, &'static str)>
fn supported_control_commands(&self) -> Vec<(u32, &'static str)>
Get a list of supported control commands
§Returns
A vector of tuples containing (command_id, description) for each supported control command. This can be used for introspection and debugging purposes.
§Default Implementation
The default implementation returns an empty vector, indicating no control commands are supported.