Skip to main content

normalize_namespace

Function normalize_namespace 

Source
pub fn normalize_namespace(input: &str) -> String
Expand description

Normalize a namespace input to the canonical form accepted by validate_namespace. Not called by write paths (would lowercase existing flat namespaces and break their lookup keys); instead exposed as a helper that callers opt into, and used by Task 1.5+ when accepting user-typed hierarchical paths.

  • Trim leading/trailing whitespace
  • Strip leading/trailing /
  • Collapse consecutive / into a single separator
  • Lowercase the result

This is a pure helper; the write path does not auto-apply it so that callers retain control over case sensitivity on existing flat namespaces. Use it when you need to accept loose user input and produce a matchable canonical key.