Skip to content

Thoughts on str versus OsStr #6

@sebastianblunt

Description

@sebastianblunt

Currently I see no way to pass in an OsStr as an argument to a shell function.

The big benefit I see to the current way is that it allows a shell function to take any type that is Display, which is certainly a nice property to have. But it also prevents you from passing in values that are not valid UTF-8.

The best option that I see would be to add an osstr option, e.g.

#[shell(osstr)]

to change the requirement of the arguments to be AsRef<OsStr> instead of ToString. (Maybe per field would be better.)

The alternative I see would be to define a new trait for this case, but that's inconvenient without trait specialization.

Thoughts?

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