Struct iref::iri::Fragment

source ·
pub struct Fragment(/* private fields */);
Expand description

IRI fragment.

Implementations§

source§

impl Fragment

source

pub fn new<T>(input: &T) -> Result<&Fragment, InvalidFragment<&T>>
where T: AsRef<str> + ?Sized,

Creates a new IRI fragment by parsing the input value

source

pub const unsafe fn new_unchecked(input: &str) -> &Fragment

Creates a new IRI fragment from the input value without validation.

§Safety

The input data must be a valid IRI fragment.

source

pub fn validate(input: impl Iterator<Item = char>) -> bool

Checks that the input iterator produces a valid IRI fragment

source§

impl Fragment

source

pub const EMPTY: &'static Fragment = _

source§

impl Fragment

source

pub fn as_str(&self) -> &str

source

pub fn as_bytes(&self) -> &[u8]

source§

impl Fragment

source

pub fn as_pct_str(&self) -> &PctStr

Returns the fragment as a percent-encoded string slice.

Methods from Deref<Target = PctStr>§

source

pub fn len(&self) -> usize

Length of the decoded string (character count).

Computed in linear time. This is different from the byte length, which can be retrieved using value.as_bytes().len().

source

pub fn is_empty(&self) -> bool

Checks if the string is empty.

source

pub fn as_bytes(&self) -> &[u8]

Returns the underlying percent-encoding bytes.

source

pub fn as_str(&self) -> &str

Get the underlying percent-encoded string slice.

source

pub fn chars(&self) -> Chars<'_>

Iterate over the encoded characters of the string.

source

pub fn bytes(&self) -> Bytes<'_>

Iterate over the encoded bytes of the string.

source

pub fn decode(&self) -> String

Decoding.

Return the string with the percent-encoded characters decoded.

Trait Implementations§

source§

impl AsRef<[u8]> for Fragment

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Fragment> for Fragment

source§

fn as_ref(&self) -> &Fragment

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Fragment> for FragmentBuf

source§

fn as_ref(&self) -> &Fragment

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<str> for Fragment

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<Fragment> for FragmentBuf

source§

fn borrow(&self) -> &Fragment

Immutably borrows from an owned value. Read more
source§

impl Borrow<str> for Fragment

source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
source§

impl Debug for Fragment

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Deref for Fragment

§

type Target = PctStr

The resulting type after dereferencing.
source§

fn deref(&self) -> &<Fragment as Deref>::Target

Dereferences the value.
source§

impl<'a, 'de> Deserialize<'de> for &'a Fragment
where 'de: 'a,

source§

fn deserialize<D>( deserializer: D, ) -> Result<&'a Fragment, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Fragment

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a Fragment> for &'a str

source§

fn from(value: &'a Fragment) -> &'a str

Converts to this type from the input type.
source§

impl Hash for Fragment

source§

fn hash<H>(&self, hasher: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
source§

impl Ord for Fragment

source§

fn cmp(&self, other: &Fragment) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl<'a> PartialEq<&'a Fragment> for FragmentBuf

source§

fn eq(&self, other: &&'a Fragment) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<&'a str> for Fragment

source§

fn eq(&self, other: &&'a str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Fragment> for FragmentBuf

source§

fn eq(&self, other: &Fragment) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for Fragment

source§

fn eq(&self, other: &Fragment) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialOrd<&'a Fragment> for FragmentBuf

source§

fn partial_cmp(&self, other: &&'a Fragment) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Fragment> for FragmentBuf

source§

fn partial_cmp(&self, other: &Fragment) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd for Fragment

source§

fn partial_cmp(&self, other: &Fragment) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Fragment

source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl ToOwned for Fragment

§

type Owned = FragmentBuf

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> FragmentBuf

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<'a> TryFrom<&'a str> for &'a Fragment

§

type Error = InvalidFragment<&'a str>

The type returned in the event of a conversion error.
source§

fn try_from(input: &'a str) -> Result<&'a Fragment, InvalidFragment<&'a str>>

Performs the conversion.
source§

impl Eq for Fragment

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more