Struct libpna::EntryReference
source · pub struct EntryReference(/* private fields */);Expand description
A UTF-8 encoded entry reference.
§Examples
use libpna::EntryReference;
assert_eq!("uer/bin", EntryReference::from("uer/bin"));
assert_eq!("/user/bin", EntryReference::from("/user/bin"));
assert_eq!("/user/bin", EntryReference::from("/user/bin/"));
assert_eq!("../user/bin", EntryReference::from("../user/bin/"));
assert_eq!("/", EntryReference::from("/"));Implementations§
source§impl EntryReference
impl EntryReference
sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Extracts a string slice containing the entire EntryReference.
§Examples
Basic usage:
use libpna::EntryReference;
let r = EntryReference::from("foo");
assert_eq!("foo", r.as_str());sourcepub fn from_lossy<T: Into<PathBuf>>(p: T) -> Self
pub fn from_lossy<T: Into<PathBuf>>(p: T) -> Self
Create an EntryReference from a struct impl Into<PathBuf>.
Any non-Unicode sequences are replaced with
U+FFFD REPLACEMENT CHARACTER.
§Examples
use libpna::EntryReference;
assert_eq!("foo.txt", EntryReference::from_lossy("foo.txt"));
assert_eq!("/foo.txt", EntryReference::from_lossy("/foo.txt"));
assert_eq!("./foo.txt", EntryReference::from_lossy("./foo.txt"));
assert_eq!("../foo.txt", EntryReference::from_lossy("../foo.txt"));Trait Implementations§
source§impl AsRef<OsStr> for EntryReference
impl AsRef<OsStr> for EntryReference
source§impl AsRef<Path> for EntryReference
impl AsRef<Path> for EntryReference
source§impl AsRef<str> for EntryReference
impl AsRef<str> for EntryReference
source§impl Clone for EntryReference
impl Clone for EntryReference
source§fn clone(&self) -> EntryReference
fn clone(&self) -> EntryReference
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for EntryReference
impl Debug for EntryReference
source§impl Display for EntryReference
impl Display for EntryReference
source§impl From<&String> for EntryReference
impl From<&String> for EntryReference
source§impl From<&str> for EntryReference
impl From<&str> for EntryReference
source§impl From<String> for EntryReference
impl From<String> for EntryReference
source§impl Hash for EntryReference
impl Hash for EntryReference
source§impl Ord for EntryReference
impl Ord for EntryReference
source§fn cmp(&self, other: &EntryReference) -> Ordering
fn cmp(&self, other: &EntryReference) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<&str> for EntryReference
impl PartialEq<&str> for EntryReference
source§impl PartialEq<EntryReference> for &str
impl PartialEq<EntryReference> for &str
source§impl PartialEq<EntryReference> for str
impl PartialEq<EntryReference> for str
source§impl PartialEq<str> for EntryReference
impl PartialEq<str> for EntryReference
source§impl PartialEq for EntryReference
impl PartialEq for EntryReference
source§impl PartialOrd for EntryReference
impl PartialOrd for EntryReference
source§impl TryFrom<&OsStr> for EntryReference
impl TryFrom<&OsStr> for EntryReference
source§impl TryFrom<&Path> for EntryReference
impl TryFrom<&Path> for EntryReference
source§fn try_from(value: &Path) -> Result<Self, Self::Error>
fn try_from(value: &Path) -> Result<Self, Self::Error>
§Examples
use libpna::EntryReference;
use std::path::Path;
let p = Path::new("path/to/file");
assert_eq!("path/to/file", EntryReference::try_from(p).unwrap());source§type Error = EntryReferenceError
type Error = EntryReferenceError
The type returned in the event of a conversion error.
impl Eq for EntryReference
impl StructuralPartialEq for EntryReference
Auto Trait Implementations§
impl Freeze for EntryReference
impl RefUnwindSafe for EntryReference
impl Send for EntryReference
impl Sync for EntryReference
impl Unpin for EntryReference
impl UnwindSafe for EntryReference
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)