flexstr_support 0.1.4

Support crate for 'flexstr' and 'inline_flexstr'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::{ffi::OsStr, path::Path};

use crate::traits::StringToFromBytes;

// *** StringToFromBytes ***

impl StringToFromBytes for Path {
    #[inline]
    fn bytes_as_self(bytes: &[u8]) -> &Self {
        Path::new(OsStr::bytes_as_self(bytes))
    }

    #[inline]
    fn self_as_raw_bytes(&self) -> &[u8] {
        OsStr::self_as_bytes(self.as_os_str())
    }
}