Skip to content

PathBuf does not have is_empty() #30259

Closed
@dhardy

Description

@dhardy

It is possible to create an empty PathBuf:

let p = PathBuf::new();

— yet PathBuf has no is_empty() function (nor, apparently, do Path or OsStr or OsString).

This seems inconsistent.

Of course, there are several ways around this (p == PathBuf::new(), p.to_str().map_or(true, |s| s.is_empty()), wrapping with Option), but having a simple way to check this would be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions