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_lossy("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 Ord for EntryName
impl Ord for EntryName
source§impl PartialEq<&str> for EntryName
impl PartialEq<&str> for EntryName
source§impl PartialEq<EntryName> for &str
impl PartialEq<EntryName> for &str
source§impl PartialEq<EntryName> for str
impl PartialEq<EntryName> for str
source§impl PartialEq for EntryName
impl PartialEq for EntryName
source§impl PartialOrd for EntryName
impl PartialOrd for EntryName
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl TryFrom<&str> for EntryName
impl TryFrom<&str> for EntryName
source§fn try_from(value: &str) -> Result<Self, Self::Error>
fn try_from(value: &str) -> Result<Self, Self::Error>
Examples
use libpna::EntryName;
assert_eq!(EntryName::try_from("test.txt"), EntryName::try_from("test.txt"));
assert_eq!(EntryName::try_from("/test.txt"), EntryName::try_from("test.txt"));
assert_eq!(EntryName::try_from("./test.txt"), EntryName::try_from("test.txt"));
assert_eq!(EntryName::try_from("../test.txt"), EntryName::try_from("test.txt"));§type Error = EntryNameError
type Error = EntryNameError
The type returned in the event of a conversion error.
impl Eq for EntryName
impl StructuralEq for EntryName
impl StructuralPartialEq for EntryName
Auto Trait Implementations§
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