pub trait Utf8Encoding<'a>: Sealed {
type Components: Utf8Components<'a>;
// Required methods
fn label() -> &'static str;
fn components(path: &'a str) -> Self::Components;
fn hash<H: Hasher>(path: &str, h: &mut H);
fn push(current_path: &mut String, path: &str);
fn push_checked(
current_path: &mut String,
path: &str,
) -> Result<(), CheckedPathError>;
}Expand description
Interface to provide meaning to a byte slice such that paths can be derived
Required Associated Types§
sourcetype Components: Utf8Components<'a>
type Components: Utf8Components<'a>
Represents the type of component that will be derived by this encoding
Required Methods§
sourcefn components(path: &'a str) -> Self::Components
fn components(path: &'a str) -> Self::Components
Produces an iterator of Utf8Components over the given the byte slice (path)
sourcefn push(current_path: &mut String, path: &str)
fn push(current_path: &mut String, path: &str)
Pushes a utf8 str (path) onto the an existing path (current_path)
sourcefn push_checked(
current_path: &mut String,
path: &str,
) -> Result<(), CheckedPathError>
fn push_checked( current_path: &mut String, path: &str, ) -> Result<(), CheckedPathError>
Like Utf8Encoding::push, but enforces several new rules:
pathcannot contain a prefix component.pathcannot contain a root component.pathcannot contain invalid filename characters.pathcannot contain parent components such that the current path would be escaped.
Object Safety§
This trait is not object safe.