pub struct Segment(/* private fields */);Expand description
IRI path segment.
Implementations§
Source§impl Segment
impl Segment
pub const fn validate_str(input: &str) -> bool
pub const fn validate_bytes(input: &[u8]) -> bool
Source§impl Segment
impl Segment
Sourcepub fn new<T: ?Sized + AsRef<[u8]>>(
input: &T,
) -> Result<&Self, InvalidSegment<&T>>
pub fn new<T: ?Sized + AsRef<[u8]>>( input: &T, ) -> Result<&Self, InvalidSegment<&T>>
Creates a new segment by parsing the input value.
Sourcepub const fn from_bytes(input: &[u8]) -> Result<&Self, InvalidSegment<&[u8]>>
pub const fn from_bytes(input: &[u8]) -> Result<&Self, InvalidSegment<&[u8]>>
Creates a new segment by parsing the input bytes.
Sourcepub const fn from_str(input: &str) -> Result<&Self, InvalidSegment<&str>>
pub const fn from_str(input: &str) -> Result<&Self, InvalidSegment<&str>>
Creates a new segment by parsing the input string.
Sourcepub const unsafe fn new_unchecked_from_bytes(input: &[u8]) -> &Self
pub const unsafe fn new_unchecked_from_bytes(input: &[u8]) -> &Self
Creates a new segment from the input bytes without validation.
§Safety
The input bytes must be a valid segment.
Sourcepub const unsafe fn new_unchecked(input: &str) -> &Self
pub const unsafe fn new_unchecked(input: &str) -> &Self
Creates a new segment from the input string without validation.
§Safety
The input string must be a valid segment.
Source§impl Segment
impl Segment
Sourcepub fn as_pct_str(&self) -> &PctStr
pub fn as_pct_str(&self) -> &PctStr
Returns the segment as a percent-encoded string slice.
Sourcepub fn looks_like_scheme(&self) -> bool
pub fn looks_like_scheme(&self) -> bool
Checks if this segment looks like a scheme.
Returns true if it is of the form prefix:suffix where prefix is a
valid scheme, of false otherwise.
Methods from Deref<Target = PctStr>§
Trait Implementations§
Source§impl AsRef<Segment> for SegmentBuf
impl AsRef<Segment> for SegmentBuf
Source§impl Borrow<Segment> for SegmentBuf
impl Borrow<Segment> for SegmentBuf
Source§impl<'a, 'de> Deserialize<'de> for &'a Segmentwhere
'de: 'a,
impl<'a, 'de> Deserialize<'de> for &'a Segmentwhere
'de: 'a,
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Segment
Source§impl<'a> FromIterator<&'a Segment> for PathBuf
Available on crate feature std only.
impl<'a> FromIterator<&'a Segment> for PathBuf
Available on crate feature
std only.Source§impl PartialEq<&Segment> for SegmentBuf
impl PartialEq<&Segment> for SegmentBuf
Source§impl PartialEq<Segment> for SegmentBuf
impl PartialEq<Segment> for SegmentBuf
Source§impl PartialEq<SegmentBuf> for Segment
impl PartialEq<SegmentBuf> for Segment
Source§fn eq(&self, other: &SegmentBuf) -> bool
fn eq(&self, other: &SegmentBuf) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialEq<SegmentBuf> for &Segment
impl PartialEq<SegmentBuf> for &Segment
Source§fn eq(&self, other: &SegmentBuf) -> bool
fn eq(&self, other: &SegmentBuf) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for Segment
impl PartialOrd for Segment
Source§impl PartialOrd<&PctStr> for Segment
impl PartialOrd<&PctStr> for Segment
Source§impl PartialOrd<&Segment> for SegmentBuf
impl PartialOrd<&Segment> for SegmentBuf
Source§impl PartialOrd<&[u8]> for Segment
impl PartialOrd<&[u8]> for Segment
Source§impl PartialOrd<&str> for Segment
impl PartialOrd<&str> for Segment
Source§impl PartialOrd<PctStr> for Segment
impl PartialOrd<PctStr> for Segment
Source§impl PartialOrd<PctString> for Segment
impl PartialOrd<PctString> for Segment
Source§impl PartialOrd<Segment> for [u8]
impl PartialOrd<Segment> for [u8]
Source§impl PartialOrd<Segment> for &[u8]
impl PartialOrd<Segment> for &[u8]
Source§impl PartialOrd<Segment> for str
impl PartialOrd<Segment> for str
Source§impl PartialOrd<Segment> for &str
impl PartialOrd<Segment> for &str
Source§impl PartialOrd<Segment> for PctStr
impl PartialOrd<Segment> for PctStr
Source§impl PartialOrd<Segment> for &PctStr
impl PartialOrd<Segment> for &PctStr
Source§impl PartialOrd<Segment> for Vec<u8>
impl PartialOrd<Segment> for Vec<u8>
Source§impl PartialOrd<Segment> for String
impl PartialOrd<Segment> for String
Source§impl PartialOrd<Segment> for PctString
impl PartialOrd<Segment> for PctString
Source§impl PartialOrd<Segment> for SegmentBuf
impl PartialOrd<Segment> for SegmentBuf
Source§impl PartialOrd<SegmentBuf> for Segment
impl PartialOrd<SegmentBuf> for Segment
Source§impl PartialOrd<SegmentBuf> for &Segment
impl PartialOrd<SegmentBuf> for &Segment
Source§impl PartialOrd<String> for Segment
impl PartialOrd<String> for Segment
Source§impl PartialOrd<Vec<u8>> for Segment
impl PartialOrd<Vec<u8>> for Segment
Source§impl PartialOrd<[u8]> for Segment
impl PartialOrd<[u8]> for Segment
Source§impl PartialOrd<str> for Segment
impl PartialOrd<str> for Segment
Source§impl ToOwned for Segment
impl ToOwned for Segment
Source§type Owned = SegmentBuf
type Owned = SegmentBuf
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more