pub trait PathDisplayExt {
// Required methods
fn display_posix(&self) -> String;
fn posix(&self) -> PathPosix<'_>;
}Expand description
Display-only extension for human-facing path output. On Windows, folds
\ → / so a status subject or error message shows POSIX-form paths
consistently across runners. On Unix, passes through unchanged — a
legitimate \ in a Unix filename survives byte-for-byte.
display_posix() is the eager form (returns String).
posix() is the lazy form — returns impl Display so it composes with
format!/write!/println! without an intermediate allocation.
Use in:
- Printer status subjects (
status[_simple], kv values, error messages) tracing::info!/warn!/error!event fields where the path is the human-visible value
Do NOT use in:
- JSON / YAML / SQLite / OCI / gateway boundaries — use
to_posix_stringinstead (always folds, not Windows-only) - Debug-only
tracing::debug!/trace!event fields — keep native so debug tooling sees what’s on disk
Required Methods§
Sourcefn display_posix(&self) -> String
fn display_posix(&self) -> String
Eager: returns a String with \ folded to / on Windows, native on Unix.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".