Function path_to_bytes

Source
pub fn path_to_bytes(path: &Path) -> Result<&[u8], BadPathEncoding>
Expand description

Converts path to bytes in platform-specific manner.

On Unix, this function never fails because paths are just bytes. On Windows, this may return error if the input wasn’t well-formed UTF-8.

The returned byte sequence can be considered a superset of ASCII (such as UTF-8 bytes.)