Skip to main content

DeviceOps

Trait DeviceOps 

Source
pub trait DeviceOps:
    DynClone
    + Send
    + Sync
    + AsAny
    + 'static {
    // Required method
    fn open(
        &self,
        current_task: &CurrentTask,
        devt: DeviceId,
        node: &NamespaceNode,
        flags: OpenFlags,
    ) -> Result<Box<dyn FileOps>, Errno>;
}

Required Methods§

Source

fn open( &self, current_task: &CurrentTask, devt: DeviceId, node: &NamespaceNode, flags: OpenFlags, ) -> Result<Box<dyn FileOps>, Errno>

Instantiate a FileOps for this device.

This function is called when userspace opens a file with a DeviceId assigned to this device.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl DeviceOps for Arc<SerialDevice>

Source§

fn open( &self, _current_task: &CurrentTask, _id: DeviceId, _node: &NamespaceNode, _flags: OpenFlags, ) -> Result<Box<dyn FileOps>, Errno>

Implementors§

Source§

impl<F> DeviceOps for F
where F: Clone + Send + Sync + Fn(&CurrentTask, DeviceId, &NamespaceNode, OpenFlags) -> Result<Box<dyn FileOps>, Errno> + 'static,

Allows directly using a function or closure as an implementation of DeviceOps, avoiding having to write a zero-size struct and an impl for it.