pub struct EntryName(/* private fields */);Expand description
A UTF-8 encoded entry name.
Implementations§
Source§impl EntryName
impl EntryName
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Extracts a string slice containing the entire EntryName.
§Examples
use libpna::EntryName;
let name = EntryName::from("foo");
assert_eq!("foo", name.as_str());Sourcepub fn from_lossy<T: Into<PathBuf>>(p: T) -> Self
pub fn from_lossy<T: Into<PathBuf>>(p: T) -> Self
Create an EntryName from a struct impl Into<PathBuf>.
Any non-Unicode sequences are replaced with
U+FFFD REPLACEMENT CHARACTER and
any path components not match with Component::Normal are removed.
§Examples
use libpna::EntryName;
assert_eq!("foo.txt", EntryName::from_lossy("foo.txt"));
assert_eq!("foo.txt", EntryName::from_lossy("/foo.txt"));
assert_eq!("foo.txt", EntryName::from_lossy("./foo.txt"));
assert_eq!("foo.txt", EntryName::from_lossy("../foo.txt"));Trait Implementations§
Source§impl From<&str> for EntryName
impl From<&str> for EntryName
Source§fn from(value: &str) -> Self
fn from(value: &str) -> Self
§Examples
use libpna::EntryName;
assert_eq!(EntryName::from("test.txt"), EntryName::from("test.txt"));
assert_eq!(EntryName::from("/test.txt"), EntryName::from("test.txt"));
assert_eq!(EntryName::from("./test.txt"), EntryName::from("test.txt"));
assert_eq!(EntryName::from("../test.txt"), EntryName::from("test.txt"));Source§impl Ord for EntryName
impl Ord for EntryName
Source§impl PartialEq<EntryName> for &str
impl PartialEq<EntryName> for &str
Source§impl PartialOrd for EntryName
impl PartialOrd for EntryName
impl Eq for EntryName
impl StructuralPartialEq for EntryName
Auto Trait Implementations§
impl Freeze for EntryName
impl RefUnwindSafe for EntryName
impl Send for EntryName
impl Sync for EntryName
impl Unpin for EntryName
impl UnwindSafe for EntryName
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more