Skip to content

Type parameters better have defaults in the presence of Option #143

Open
@gkoz

Description

@gkoz

This

pub fn set_label_widget<T: Upcast<Widget>>(&self, label_widget: Option<&T>)

requires jumping through hoops to pass None:

    x.set_label_widget(None::<Widget>);

There's not much we can do to help it at the moment, because default type parameters don't inform type inference yet. When that is fixed the following signature is going to be more ergonomic;

pub fn set_label_widget<T: Upcast<Widget> = Widget>(&self, label_widget: Option<&T>)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions