Skip to content

Generic dependent on sync/async #16

@chrenderle

Description

@chrenderle

Hi, your crate is exactly what I'm looking for. I'm writing an embedded device driver. There I want to present every function as a sync one and a async one with the postfix _async in the name. All this should be possible with your crate.

But I have one requirement I couldn't find how to do with your crate:
The sync functions use the embedded_hal traits which are sync. The async functions use the embedded_hal_async traits which are async. Have a look at the following example. Currently I implement these functions manually sync and async:

impl<BUS> Driver<BUS> {
    pub fn read_eeprom(&mut self, /* arguments */) -> Result<(), BUS::Error>
    where BUS: embedded_hal::i2c::I2c
    {
        self.device_driver.read_eeprom(/* arguments */)
    }

    pub fn read_eeprom_async(&mut self, /* arguments */) -> Result<(), BUS::Error>
    where BUS: embedded_hal_async::i2c::I2c
    {
        self.device_driver.read_eeprom_async(/* arguments */).await
    }
}

As far as I could see this is currently not possible with your crate. If it is please let me know how, otherwise please see this as a feature request :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions