pub trait DriverMutexClient {
// Required method
fn ready(&'static self, resource: DriverMutexAny);
}Expand description
Client interface for accessing resources wrapped in a DriverMutex
This trait must be implemented by any kernel object wishing to access a resource managed by a
DriverMutex. The trait defines a single callback method ready() which will be invoked by the
DriverMutex when the resource becomes available.
Note that this contract does not directly provide a DriverMutexRef, but rather an instance
of DriverMutexAny. It is the responsibility of the client to downcast the DriverMutexAny
into the appropriate concrete type T before it can be used.
The reason for this extra indirection/reflection is to facilitate complex clients needing to
interact with multiple DriverMutex instances. If we had made DriverMutexClient generic over
T, then it would be practically impossible for such clients to impl the trait multiple times
for each different T type, as doing so would cause Rust to complain about
ambiguous/conflicting trait implementations.
Required Methods§
Sourcefn ready(&'static self, resource: DriverMutexAny)
fn ready(&'static self, resource: DriverMutexAny)
Called by the DriverMutex when the resource becomes available.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".