PathView
Borrows immutable native filename units without retaining their owner. Native units preserve filenames independently of Unicode validity. Construction rejects NUL and adds no normalization, separator rewriting, allocation or cwd lookup. Views expire with backing mutation/move/destruction. Copying a view does not retain backing. Concurrent access needs the backing owner's contract. TryToString allocates explicitly; TryViewUtf8 validates a borrowed byte view.
Module std.fs
import std.fs;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
PathView
pub final class PathViewBorrows immutable native filename units without retaining their owner. Native units preserve filenames independently of Unicode validity. Construction rejects NUL and adds no normalization, separator rewriting, allocation or cwd lookup. Views expire with backing mutation/move/destruction. Copying a view does not retain backing. Concurrent access needs the backing owner's contract. TryToString allocates explicitly; TryViewUtf8 validates a borrowed byte view.
PathView.init
pub init()Creates valid empty byte view without allocation.
PathView.Encoding
pub Encoding: PathEncoding;Observes exact active native unit kind.
PathView.UnitLength
pub UnitLength: usize;Counts active native units, not Unicode scalars or UTF-16 bytes.
PathView.IsEmpty
pub IsEmpty: bool;Observes an empty native representation.
PathView.NativeBytes
pub NativeBytes: readonly byte[]?;Borrows exact byte units when active; none for UTF-16.
PathView.NativeUtf16
pub NativeUtf16: readonly u16[]?;Borrows exact UTF-16 units when active; none for bytes.
PathView.TryFromNativeBytes
pub static fn TryFromNativeBytes(Units: readonly byte[]) -> Result<PathView, PathError>Validates NUL-free native bytes without Unicode conversion/allocation. Units: Borrowed exact bytes; caller retains backing. Return: View or EmbeddedNul.
PathView.TryFromNativeUtf16
pub static fn TryFromNativeUtf16(Units: readonly u16[]) -> Result<PathView, PathError>Validates NUL-free native UTF-16 without rejecting unpaired surrogates. Units: Borrowed exact units; caller retains backing. Return: View or EmbeddedNul.
PathView.TryViewUtf8
pub readonly fn TryViewUtf8() -> str?Validates a borrowed UTF-8 view of active native bytes. Return: Borrowed text, or none for invalid UTF-8/UTF-16 representation. Warning: Does not allocate or retain backing.
PathView.TryToString
pub readonly fn TryToString() -> Result<String, PathError>Converts native units into owned UTF-8 text without changing the path. Return: Owned String or exact Unicode/storage failure. Warning: May allocate; unpaired native UTF-16 remains preserved on failure.