pub unsafe trait Path: Debug + Display {
// Required method
fn as_bytes(&self) -> &[u8] ⓘ;
// Provided methods
fn as_ptr(&self) -> *const u8 { ... }
fn size(&self) -> usize { ... }
fn len_steps(&self) -> usize { ... }
}Expand description
Marker trait for methods on types representing path-encodings.
Path encoding maintains the following invariants:
- paths begin with
b'/'. - paths are a sequence of non-empty steps, separated by a single
b'/'. - steps are a sequence of either ascii-encoded alphanumeric bytes, or
b'.'orb'_'orb'-'. - the maximum length of a path is PATH_MAX_SIZE.
where
b'/'is the PATH_SEPARATOR.
i.e. path encoding may be summarised by the regex (\/[A-Za-z0-9._\-]+)+ up to a maximum
PATH_MAX_SIZE bytes.
§Safety
Path is unsafe to implement, as other code (e.g. Runtime) rely on any
T: impl Path being correctly path-encoded.