[−][src]Struct iri_string::types::RiFragmentStr
A borrowed slice of an IRI fragment (i.e. after the first #
character).
This corresponds to ifragment
rule in RFC 3987 (and fragment
rule in RFC 3986).
The rule for ifragment
is *( ipchar / "/" / "?" )
.
Valid values
This type can have an IRI fragment.
Note that the IRI foo://bar/baz#qux
has the fragment qux
, not #qux
.
assert!(IriFragmentStr::new("").is_ok()); assert!(IriFragmentStr::new("foo").is_ok()); assert!(IriFragmentStr::new("foo/bar").is_ok()); assert!(IriFragmentStr::new("/foo/bar").is_ok()); assert!(IriFragmentStr::new("//foo/bar").is_ok()); assert!(IriFragmentStr::new("https://user:pass@example.com:8080").is_ok()); assert!(IriFragmentStr::new("https://example.com/").is_ok());
Some characters and sequences cannot used in a fragment.
// `<` and `>` cannot directly appear in an IRI reference. assert!(IriFragmentStr::new("<not allowed>").is_err()); // Broken percent encoding cannot appear in an IRI reference. assert!(IriFragmentStr::new("%").is_err()); assert!(IriFragmentStr::new("%GG").is_err()); // Hash sign `#` cannot appear in an IRI fragment. assert!(IriFragmentStr::new("#hash").is_err());
Methods
impl<S: Spec> RiFragmentStr<S>
[src]
pub fn new(s: &str) -> Result<&Self, Error>
[src]
Creates a new string.
pub fn as_str(&self) -> &str
[src]
Returns &str
.
pub fn len(&self) -> usize
[src]
Returns the string length.
pub fn is_empty(&self) -> bool
[src]
Returns whether the string is empty.
impl<S: Spec> RiFragmentStr<S>
[src]
pub fn from_prefixed(s: &str) -> Result<&Self, Error>
[src]
Creates a new &RiFragmentStr
from the fragment part prefixed by #
.
Examples
assert!(IriFragmentStr::from_prefixed("#").is_ok()); assert!(IriFragmentStr::from_prefixed("#foo").is_ok()); assert!(IriFragmentStr::from_prefixed("#foo/bar").is_ok()); assert!(IriFragmentStr::from_prefixed("#/foo/bar").is_ok()); assert!(IriFragmentStr::from_prefixed("#//foo/bar").is_ok()); assert!(IriFragmentStr::from_prefixed("#https://user:pass@example.com:8080").is_ok()); assert!(IriFragmentStr::from_prefixed("#https://example.com/").is_ok()); // `<` and `>` cannot directly appear in an IRI. assert!(IriFragmentStr::from_prefixed("#<not allowed>").is_err()); // Broken percent encoding cannot appear in an IRI. assert!(IriFragmentStr::new("#%").is_err()); assert!(IriFragmentStr::new("#%GG").is_err()); // `#` prefix is expected. assert!(IriFragmentStr::from_prefixed("").is_err()); assert!(IriFragmentStr::from_prefixed("foo").is_err()); // Hash sign `#` cannot appear in an IRI fragment. assert!(IriFragmentStr::from_prefixed("##hash").is_err());
Trait Implementations
impl AsRef<RiFragmentStr<IriSpec>> for RiFragmentStr<UriSpec>
[src]
fn as_ref(&self) -> &RiFragmentStr<IriSpec>
[src]
impl AsRef<RiFragmentStr<IriSpec>> for RiFragmentString<UriSpec>
[src]
fn as_ref(&self) -> &RiFragmentStr<IriSpec>
[src]
impl<S: Spec> AsRef<RiFragmentStr<S>> for RiFragmentStr<S>
[src]
fn as_ref(&self) -> &RiFragmentStr<S>
[src]
impl<S: Spec> AsRef<RiFragmentStr<S>> for RiFragmentString<S>
[src]
fn as_ref(&self) -> &RiFragmentStr<S>
[src]
impl<S: Spec> AsRef<str> for RiFragmentStr<S>
[src]
impl<S: Spec> Borrow<RiFragmentStr<S>> for RiFragmentString<S>
[src]
fn borrow(&self) -> &RiFragmentStr<S>
[src]
impl<S: Spec> Debug for RiFragmentStr<S>
[src]
impl<'de: 'a, 'a, S: 'de + Spec> Deserialize<'de> for &'a RiFragmentStr<S>
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl<S: Spec> Display for RiFragmentStr<S>
[src]
impl<S: Spec> Eq for RiFragmentStr<S>
[src]
impl<'_, S: Spec> From<&'_ RiFragmentStr<S>> for Arc<RiFragmentStr<S>>
[src]
fn from(s: &RiFragmentStr<S>) -> Self
[src]
impl<'_, S: Spec> From<&'_ RiFragmentStr<S>> for Box<RiFragmentStr<S>>
[src]
fn from(s: &RiFragmentStr<S>) -> Self
[src]
impl<'_, S: Spec> From<&'_ RiFragmentStr<S>> for Rc<RiFragmentStr<S>>
[src]
fn from(s: &RiFragmentStr<S>) -> Self
[src]
impl<'_, S: Spec> From<&'_ RiFragmentStr<S>> for RiFragmentString<S>
[src]
fn from(s: &RiFragmentStr<S>) -> Self
[src]
impl<'a, S: Spec> From<&'a RiFragmentStr<S>> for &'a str
[src]
fn from(s: &'a RiFragmentStr<S>) -> &'a str
[src]
impl<S: Spec> Hash for RiFragmentStr<S>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<S: Spec> Ord for RiFragmentStr<S>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<'_, S: Spec> PartialEq<&'_ RiFragmentStr<S>> for str
[src]
fn eq(&self, o: &&RiFragmentStr<S>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec, T: Spec> PartialEq<&'_ RiFragmentStr<S>> for RiFragmentStr<T>
[src]
fn eq(&self, o: &&RiFragmentStr<S>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_, S: Spec> PartialEq<&'_ RiFragmentStr<S>> for Cow<'_, str>
[src]
fn eq(&self, o: &&RiFragmentStr<S>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_, S: Spec, T: Spec> PartialEq<&'_ RiFragmentStr<S>> for Cow<'_, RiFragmentStr<T>>
[src]
fn eq(&self, o: &&RiFragmentStr<S>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec, T: Spec> PartialEq<&'_ RiFragmentStr<S>> for RiFragmentString<T>
[src]
fn eq(&self, o: &&RiFragmentStr<S>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec> PartialEq<&'_ str> for RiFragmentStr<S>
[src]
impl<'_, '_, S: Spec, T: Spec> PartialEq<Cow<'_, RiFragmentStr<T>>> for &'_ RiFragmentStr<S>
[src]
fn eq(&self, o: &Cow<RiFragmentStr<T>>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec> PartialEq<Cow<'_, str>> for RiFragmentStr<S>
[src]
impl<'_, '_, S: Spec> PartialEq<Cow<'_, str>> for &'_ RiFragmentStr<S>
[src]
impl<S: Spec> PartialEq<RiFragmentStr<S>> for RiFragmentStr<S>
[src]
impl<S: Spec> PartialEq<RiFragmentStr<S>> for str
[src]
fn eq(&self, o: &RiFragmentStr<S>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec> PartialEq<RiFragmentStr<S>> for &'_ str
[src]
fn eq(&self, o: &RiFragmentStr<S>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec> PartialEq<RiFragmentStr<S>> for Cow<'_, str>
[src]
fn eq(&self, o: &RiFragmentStr<S>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<S: Spec, T: Spec> PartialEq<RiFragmentStr<S>> for RiFragmentString<T>
[src]
fn eq(&self, o: &RiFragmentStr<S>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec, T: Spec> PartialEq<RiFragmentStr<T>> for &'_ RiFragmentStr<S>
[src]
fn eq(&self, o: &RiFragmentStr<T>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<S: Spec, T: Spec> PartialEq<RiFragmentString<T>> for RiFragmentStr<S>
[src]
fn eq(&self, o: &RiFragmentString<T>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec, T: Spec> PartialEq<RiFragmentString<T>> for &'_ RiFragmentStr<S>
[src]
fn eq(&self, o: &RiFragmentString<T>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<S: Spec> PartialEq<str> for RiFragmentStr<S>
[src]
impl<'_, S: Spec> PartialEq<str> for &'_ RiFragmentStr<S>
[src]
impl<'_, S: Spec> PartialOrd<&'_ RiFragmentStr<S>> for str
[src]
fn partial_cmp(&self, o: &&RiFragmentStr<S>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec, T: Spec> PartialOrd<&'_ RiFragmentStr<S>> for RiFragmentStr<T>
[src]
fn partial_cmp(&self, o: &&RiFragmentStr<S>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_, S: Spec> PartialOrd<&'_ RiFragmentStr<S>> for Cow<'_, str>
[src]
fn partial_cmp(&self, o: &&RiFragmentStr<S>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_, S: Spec, T: Spec> PartialOrd<&'_ RiFragmentStr<S>> for Cow<'_, RiFragmentStr<T>>
[src]
fn partial_cmp(&self, o: &&RiFragmentStr<S>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec, T: Spec> PartialOrd<&'_ RiFragmentStr<S>> for RiFragmentString<T>
[src]
fn partial_cmp(&self, o: &&RiFragmentStr<S>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec> PartialOrd<&'_ str> for RiFragmentStr<S>
[src]
fn partial_cmp(&self, o: &&str) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_, S: Spec, T: Spec> PartialOrd<Cow<'_, RiFragmentStr<T>>> for &'_ RiFragmentStr<S>
[src]
fn partial_cmp(&self, o: &Cow<RiFragmentStr<T>>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec> PartialOrd<Cow<'_, str>> for RiFragmentStr<S>
[src]
fn partial_cmp(&self, o: &Cow<str>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_, S: Spec> PartialOrd<Cow<'_, str>> for &'_ RiFragmentStr<S>
[src]
fn partial_cmp(&self, o: &Cow<str>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<S: Spec> PartialOrd<RiFragmentStr<S>> for RiFragmentStr<S>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<S: Spec> PartialOrd<RiFragmentStr<S>> for str
[src]
fn partial_cmp(&self, o: &RiFragmentStr<S>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec> PartialOrd<RiFragmentStr<S>> for &'_ str
[src]
fn partial_cmp(&self, o: &RiFragmentStr<S>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec> PartialOrd<RiFragmentStr<S>> for Cow<'_, str>
[src]
fn partial_cmp(&self, o: &RiFragmentStr<S>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<S: Spec, T: Spec> PartialOrd<RiFragmentStr<S>> for RiFragmentString<T>
[src]
fn partial_cmp(&self, o: &RiFragmentStr<S>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec, T: Spec> PartialOrd<RiFragmentStr<T>> for &'_ RiFragmentStr<S>
[src]
fn partial_cmp(&self, o: &RiFragmentStr<T>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<S: Spec, T: Spec> PartialOrd<RiFragmentString<T>> for RiFragmentStr<S>
[src]
fn partial_cmp(&self, o: &RiFragmentString<T>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec, T: Spec> PartialOrd<RiFragmentString<T>> for &'_ RiFragmentStr<S>
[src]
fn partial_cmp(&self, o: &RiFragmentString<T>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<S: Spec> PartialOrd<str> for RiFragmentStr<S>
[src]
fn partial_cmp(&self, o: &str) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, S: Spec> PartialOrd<str> for &'_ RiFragmentStr<S>
[src]
fn partial_cmp(&self, o: &str) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<S> Serialize for RiFragmentStr<S>
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<S: Spec> ToOwned for RiFragmentStr<S>
[src]
type Owned = RiFragmentString<S>
The resulting type after obtaining ownership.
fn to_owned(&self) -> Self::Owned
[src]
fn clone_into(&self, target: &mut Self::Owned)
[src]
impl<'a, S: Spec> TryFrom<&'a str> for &'a RiFragmentStr<S>
[src]
Auto Trait Implementations
impl<S> RefUnwindSafe for RiFragmentStr<S>
impl<S> Send for RiFragmentStr<S>
impl<S> Sync for RiFragmentStr<S>
impl<S> Unpin for RiFragmentStr<S>
impl<S> UnwindSafe for RiFragmentStr<S>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,