Skip to content

Cannot implement WriteTarget for multiple word sizes #16

@jonas-schievink

Description

@jonas-schievink

I have a use case where I'd like to reuse a buffer type for multiple different DMA operations that require different word sizes and alignments. Basically what I'd like to use as the buffer type is

union Buffer {
    u8: [u8; 1024],
    i16: [i16; 512],
}

Now I'd like to implement WriteTarget twice for this type, with a u8 and i16 word. Unfortunately that doesn't work, since the word type is an associated type of the WriteTarget trait. Maybe it would be better if it was a type parameter instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions