Skip to content

How to write generic code when methods have private traits as bounds? #860

@FeldrinH

Description

@FeldrinH

Maybe I'm misunderstanding something about the overall design of this HAL, but this is what I'm struggling with:

I would like to write some code that accepts a generic timer peripheral and then uses it to generate some PWM outputs. The trouble is that methods like FTimer::pwm have private traits in their bounds. I can't use these in my own bounds, so how can I write generic code that calls FTimer::pwm on any timer that supports it?

More generally, there are a number of methods that have private traits as bounds on their types. What is the intended approach if I want to write generic code that calls these methods. Is it just impossible?

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