Trait RawResourceAccess

Source
pub trait RawResourceAccess: ParentDevice {
    type DynResource: DynResource + ?Sized;

    // Required method
    fn raw<'a>(
        &'a self,
        guard: &'a SnatchGuard<'_>,
    ) -> Option<&'a Self::DynResource>;

    // Provided method
    fn try_raw<'a>(
        &'a self,
        guard: &'a SnatchGuard<'_>,
    ) -> Result<&'a Self::DynResource, DestroyedResourceError> { ... }
}
Expand description

Allow access to the hal resource as guarded by the SnatchGuard.

Required Associated Types§

Required Methods§

Source

fn raw<'a>( &'a self, guard: &'a SnatchGuard<'_>, ) -> Option<&'a Self::DynResource>

Get access to the raw resource if it is not destroyed.

Returns None if the resource has been destroyed. This method does not allocate in either case.

Provided Methods§

Source

fn try_raw<'a>( &'a self, guard: &'a SnatchGuard<'_>, ) -> Result<&'a Self::DynResource, DestroyedResourceError>

Get access to the raw resource if it is not destroyed.

Returns a full error if the resource has been destroyed. This method allocates a label in the error case.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§