zephyr::object

Trait Wrapped

source
pub trait Wrapped {
    type T;
    type I;

    // Required method
    fn get_wrapped(&self, args: Self::I) -> Self::T;
}
Expand description

Define the Wrapping of a kernel object.

This trait defines the association between a static kernel object and the two associated Rust types: StaticThing and Thing. In the general case: there should be:

impl Wrapped for StaticKernelObject<kobj> {
    type T = Thing,
    type I = (),
    fn get_wrapped(&self, args: Self::I) -> Self::T {
        let ptr = self.value.get();
        // Initizlie the kobj using ptr and possible the args.
        Thing { ptr }
    }
}

Required Associated Types§

source

type T

The wrapped type. This is what init_once() on the StaticKernelObject will return after initialization.

source

type I

The wrapped type also requires zero or more initializers. Which are represented by this type.

Required Methods§

source

fn get_wrapped(&self, args: Self::I) -> Self::T

Initialize this kernel object, and return the wrapped pointer.

Implementors§