automata/fsevent/path
Types
A path that has been canonicalised into a portable form: backslashes become forward slashes, repeated separators are collapsed, trailing separators are stripped, and segments are validated.
opaque so the only way to obtain a value is through normalize/1.
The differ keys snapshots and watch events on NormalizedPath, so
this is the type that pins down equality and ordering of paths.
pub opaque type NormalizedPath
Values
pub fn normalize(
path path: String,
) -> Result(NormalizedPath, ast.FseventError)
Canonicalise a string into a NormalizedPath.
The library does not call os.path.realpath-style resolution: it
works at the string level so it stays pure and produces the same
output on every platform regardless of the underlying filesystem.
pub fn path_equals(
left left: NormalizedPath,
right right: NormalizedPath,
) -> Bool
Structural equality on the canonicalised representation.
pub fn path_is_absolute(path path: NormalizedPath) -> Bool
True when the path is rooted: it either begins with a leading
separator after normalisation (/foo, \\srv\share → //srv/share)
or its first segment is a Windows drive letter (C:\foo → first
segment C:). Relative paths return False.
pub fn path_segments(path path: NormalizedPath) -> List(String)
The path’s segments in source order (the empty root has no segments).
pub fn path_starts_with(
path path: NormalizedPath,
prefix prefix: NormalizedPath,
) -> Bool
True when path is prefix itself or sits beneath prefix as a
proper ancestor relation (segment-wise; /var/log does not start
with /var/lo).
pub fn path_to_string(path path: NormalizedPath) -> String
The canonical string rendering of a normalised path.