pub fn is_valid_identifier_or_path(s: &str) -> bool
Expand description
Identifier & path validation.
A path may optionally start with ::
and is otherwise a ::
‑separated
list of identifiers. Identifiers follow these rules:
- Must not be empty.
- Must not be just
_
. - Must not start with two underscores (
__
). - First char: Unicode XID_Start or
_
. - Remaining chars: Unicode XID_Continue.
Any colon that is not part of a ::
token is rejected, and empty path
segments such as foo::
or foo:::bar
are invalid.