Struct iri_string::types::RiString
source · [−]pub struct RiString<S> { /* private fields */ }
Expand description
An owned string of an absolute IRI possibly with fragment part.
This corresponds to IRI
rule in RFC 3987 (and URI
rule in RFC 3986).
The rule for IRI
is scheme ":" ihier-part [ "?" iquery ] [ "#" ifragment ]
.
In other words, this is RiAbsoluteString
with fragment part allowed.
For details, see the document for RiStr
.
Enabled by alloc
or std
feature.
Implementations
sourceimpl<S: Spec> RiString<S>
impl<S: Spec> RiString<S>
sourcepub fn into_absolute_and_fragment(
self
) -> (RiAbsoluteString<S>, Option<RiFragmentString<S>>)
pub fn into_absolute_and_fragment(
self
) -> (RiAbsoluteString<S>, Option<RiFragmentString<S>>)
Splits the IRI into an absolute IRI part and a fragment part.
A leading #
character is truncated if the fragment part exists.
Examples
use std::convert::TryFrom;
let iri = "foo://bar/baz?qux=quux#corge".parse::<IriString>()?;
let (absolute, fragment) = iri.into_absolute_and_fragment();
let fragment_expected = IriFragmentString::try_from("corge".to_owned())
.map_err(|e| e.validation_error())?;
assert_eq!(absolute, "foo://bar/baz?qux=quux");
assert_eq!(fragment, Some(fragment_expected));
use std::convert::TryFrom;
let iri = "foo://bar/baz?qux=quux#".parse::<IriString>()?;
let (absolute, fragment) = iri.into_absolute_and_fragment();
let fragment_expected = IriFragmentString::try_from("".to_owned())
.map_err(|e| e.validation_error())?;
assert_eq!(absolute, "foo://bar/baz?qux=quux");
assert_eq!(fragment, Some(fragment_expected));
use std::convert::TryFrom;
let iri = "foo://bar/baz?qux=quux".parse::<IriString>()?;
let (absolute, fragment) = iri.into_absolute_and_fragment();
assert_eq!(absolute, "foo://bar/baz?qux=quux");
assert_eq!(fragment, None);
sourcepub fn into_absolute(self) -> RiAbsoluteString<S>
pub fn into_absolute(self) -> RiAbsoluteString<S>
Strips the fragment part if exists, and returns an RiAbsoluteString
.
Examples
let iri = "foo://bar/baz?qux=quux#corge".parse::<IriString>()?;
assert_eq!(iri.into_absolute(), "foo://bar/baz?qux=quux");
let iri = "foo://bar/baz?qux=quux".parse::<IriString>()?;
assert_eq!(iri.into_absolute(), "foo://bar/baz?qux=quux");
sourcepub fn set_fragment(&mut self, fragment: Option<&RiFragmentStr<S>>)
pub fn set_fragment(&mut self, fragment: Option<&RiFragmentStr<S>>)
Sets the fragment part to the given string.
Removes fragment part (and following #
character) if None
is given.
sourceimpl RiString<IriSpec>
impl RiString<IriSpec>
Conversion from an IRI into a URI.
sourcepub fn encode_to_uri(&mut self)
pub fn encode_to_uri(&mut self)
Percent-encodes the IRI into a valid URI that identifies the equivalent resource.
After the encode, the IRI is also a valid URI.
If you want a new URI string rather than modifying the IRI string,
use encode_into_uri
method.
If you need more precise control over memory allocation and buffer
handling, use MappedToUri
type.
Examples
#[cfg(feature = "alloc")] {
use iri_string::types::IriString;
let mut iri = IriString::try_from("http://example.com/?alpha=\u{03B1}")?;
iri.encode_to_uri();
assert_eq!(iri, "http://example.com/?alpha=%CE%B1");
sourcepub fn encode_into_uri(self) -> UriString
pub fn encode_into_uri(self) -> UriString
Percent-encodes the IRI into a valid URI that identifies the equivalent resource.
If you want to modify the value rather than creating a new
URI string, use encode_to_uri
method.
If you need more precise control over memory allocation and buffer
handling, use MappedToUri
type.
Examples
#[cfg(feature = "alloc")] {
use iri_string::types::{IriString, UriString};
let iri = IriString::try_from("http://example.com/?alpha=\u{03B1}")?;
// Type annotation here is not necessary.
let uri: UriString = iri.encode_into_uri();
assert_eq!(uri, "http://example.com/?alpha=%CE%B1");
sourcepub fn try_into_uri(self) -> Result<UriString, IriString>
pub fn try_into_uri(self) -> Result<UriString, IriString>
Converts an IRI into a URI without modification, if possible.
Examples
use iri_string::types::{IriString, UriString};
let ascii_iri = IriString::try_from("http://example.com/?alpha=%CE%B1")?;
assert_eq!(
ascii_iri.try_into_uri().map(|uri| uri.to_string()),
Ok("http://example.com/?alpha=%CE%B1".to_string())
);
let nonascii_iri = IriString::try_from("http://example.com/?alpha=\u{03B1}")?;
assert_eq!(
nonascii_iri.try_into_uri().map_err(|iri| iri.to_string()),
Err("http://example.com/?alpha=\u{03B1}".to_string())
);
Methods from Deref<Target = RiStr<S>>
sourcepub fn to_absolute_and_fragment(
&self
) -> (&RiAbsoluteStr<S>, Option<&RiFragmentStr<S>>)
pub fn to_absolute_and_fragment(
&self
) -> (&RiAbsoluteStr<S>, Option<&RiFragmentStr<S>>)
Splits the IRI into an absolute IRI part and a fragment part.
A leading #
character is truncated if the fragment part exists.
Examples
If the IRI has a fragment part, Some(_)
is returned.
let iri = IriStr::new("foo://bar/baz?qux=quux#corge")?;
let (absolute, fragment) = iri.to_absolute_and_fragment();
let fragment_expected = IriFragmentStr::new("corge")?;
assert_eq!(absolute, "foo://bar/baz?qux=quux");
assert_eq!(fragment, Some(fragment_expected));
When the fragment part exists but is empty string, Some(_)
is returned.
let iri = IriStr::new("foo://bar/baz?qux=quux#")?;
let (absolute, fragment) = iri.to_absolute_and_fragment();
let fragment_expected = IriFragmentStr::new("")?;
assert_eq!(absolute, "foo://bar/baz?qux=quux");
assert_eq!(fragment, Some(fragment_expected));
If the IRI has no fragment, None
is returned.
let iri = IriStr::new("foo://bar/baz?qux=quux")?;
let (absolute, fragment) = iri.to_absolute_and_fragment();
assert_eq!(absolute, "foo://bar/baz?qux=quux");
assert_eq!(fragment, None);
sourcepub fn to_absolute(&self) -> &RiAbsoluteStr<S>
pub fn to_absolute(&self) -> &RiAbsoluteStr<S>
Strips the fragment part if exists, and returns &RiAbsoluteStr
.
Examples
let iri = IriStr::new("foo://bar/baz?qux=quux#corge")?;
assert_eq!(iri.to_absolute(), "foo://bar/baz?qux=quux");
let iri = IriStr::new("foo://bar/baz?qux=quux")?;
assert_eq!(iri.to_absolute(), "foo://bar/baz?qux=quux");
sourcepub fn normalize(&self) -> Result<RiString<S>, TaskError<Error>>
pub fn normalize(&self) -> Result<RiString<S>, TaskError<Error>>
Returns the normalized IRI.
Examples
use iri_string::types::IriStr;
let iri = IriStr::new("HTTP://example.COM/foo/./bar/%2e%2e/../baz?query#fragment")?;
let normalized = iri.normalize()?;
assert_eq!(normalized, "http://example.com/baz?query#fragment");
sourcepub fn scheme_str(&self) -> &str
pub fn scheme_str(&self) -> &str
Returns the scheme.
The following colon is truncated.
Examples
use iri_string::types::IriStr;
let iri = IriStr::new("http://example.com/pathpath?queryquery#fragfrag")?;
assert_eq!(iri.scheme_str(), "http");
Returns the authority.
The leading //
is truncated.
Examples
use iri_string::types::IriStr;
let iri = IriStr::new("http://example.com/pathpath?queryquery#fragfrag")?;
assert_eq!(iri.authority_str(), Some("example.com"));
use iri_string::types::IriStr;
let iri = IriStr::new("urn:uuid:10db315b-fcd1-4428-aca8-15babc9a2da2")?;
assert_eq!(iri.authority_str(), None);
sourcepub fn path_str(&self) -> &str
pub fn path_str(&self) -> &str
Returns the path.
Examples
use iri_string::types::IriStr;
let iri = IriStr::new("http://example.com/pathpath?queryquery#fragfrag")?;
assert_eq!(iri.path_str(), "/pathpath");
use iri_string::types::IriStr;
let iri = IriStr::new("urn:uuid:10db315b-fcd1-4428-aca8-15babc9a2da2")?;
assert_eq!(iri.path_str(), "uuid:10db315b-fcd1-4428-aca8-15babc9a2da2");
sourcepub fn query_str(&self) -> Option<&str>
pub fn query_str(&self) -> Option<&str>
Returns the query.
The leading question mark (?
) is truncated.
Examples
use iri_string::types::IriStr;
let iri = IriStr::new("http://example.com/pathpath?queryquery#fragfrag")?;
assert_eq!(iri.query_str(), Some("queryquery"));
use iri_string::types::IriStr;
let iri = IriStr::new("urn:uuid:10db315b-fcd1-4428-aca8-15babc9a2da2")?;
assert_eq!(iri.query_str(), None);
sourcepub fn fragment(&self) -> Option<&RiFragmentStr<S>>
pub fn fragment(&self) -> Option<&RiFragmentStr<S>>
Returns the fragment part if exists.
A leading #
character is truncated if the fragment part exists.
Examples
let iri = IriStr::new("foo://bar/baz?qux=quux#corge")?;
let fragment = IriFragmentStr::new("corge")?;
assert_eq!(iri.fragment(), Some(fragment));
let iri = IriStr::new("foo://bar/baz?qux=quux#")?;
let fragment = IriFragmentStr::new("")?;
assert_eq!(iri.fragment(), Some(fragment));
let iri = IriStr::new("foo://bar/baz?qux=quux")?;
assert_eq!(iri.fragment(), None);
Returns the authority components.
Examples
use iri_string::types::IriStr;
let iri = IriStr::new("http://user:pass@example.com:8080/pathpath?queryquery")?;
let authority = iri.authority_components()
.expect("authority is available");
assert_eq!(authority.userinfo(), Some("user:pass"));
assert_eq!(authority.host(), "example.com");
assert_eq!(authority.port(), Some("8080"));
use iri_string::types::IriStr;
let iri = IriStr::new("urn:uuid:10db315b-fcd1-4428-aca8-15babc9a2da2")?;
assert_eq!(iri.authority_str(), None);
sourcepub fn encode_to_uri(&self) -> UriString
pub fn encode_to_uri(&self) -> UriString
Percent-encodes the IRI into a valid URI that identifies the equivalent resource.
If you need more precise control over memory allocation and buffer
handling, use MappedToUri
type.
Examples
use iri_string::types::{IriStr, UriString};
let iri = IriStr::new("http://example.com/?alpha=\u{03B1}")?;
// Type annotation here is not necessary.
let uri: UriString = iri.encode_to_uri();
assert_eq!(uri, "http://example.com/?alpha=%CE%B1");
sourcepub fn as_uri(&self) -> Option<&UriStr>
pub fn as_uri(&self) -> Option<&UriStr>
Converts an IRI into a URI without modification, if possible.
This is semantically equivalent to
UriStr::new(self.as_str()).ok()
.
Examples
use iri_string::types::{IriStr, UriStr};
let ascii_iri = IriStr::new("http://example.com/?alpha=%CE%B1")?;
assert_eq!(
ascii_iri.as_uri().map(AsRef::as_ref),
Some("http://example.com/?alpha=%CE%B1")
);
let nonascii_iri = IriStr::new("http://example.com/?alpha=\u{03B1}")?;
assert_eq!(nonascii_iri.as_uri(), None);
Trait Implementations
sourceimpl<S: Spec> AsRef<RiReferenceStr<S>> for RiString<S>
impl<S: Spec> AsRef<RiReferenceStr<S>> for RiString<S>
sourcefn as_ref(&self) -> &RiReferenceStr<S>
fn as_ref(&self) -> &RiReferenceStr<S>
Performs the conversion.
sourceimpl<'de, S: Spec> Deserialize<'de> for RiString<S>
impl<'de, S: Spec> Deserialize<'de> for RiString<S>
sourcefn 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
sourceimpl<S: Spec> From<RiAbsoluteString<S>> for RiString<S>
impl<S: Spec> From<RiAbsoluteString<S>> for RiString<S>
sourcefn from(s: RiAbsoluteString<S>) -> RiString<S>
fn from(s: RiAbsoluteString<S>) -> RiString<S>
Performs the conversion.
sourceimpl<S: Spec> From<RiString<S>> for RiReferenceString<S>
impl<S: Spec> From<RiString<S>> for RiReferenceString<S>
sourcefn from(s: RiString<S>) -> RiReferenceString<S>
fn from(s: RiString<S>) -> RiReferenceString<S>
Performs the conversion.
sourceimpl<S: Spec> Ord for RiString<S>
impl<S: Spec> Ord for RiString<S>
sourceimpl<S: Spec, T: Spec> PartialOrd<&'_ RiAbsoluteStr<S>> for RiString<T>
impl<S: Spec, T: Spec> PartialOrd<&'_ RiAbsoluteStr<S>> for RiString<T>
sourcefn partial_cmp(&self, o: &&RiAbsoluteStr<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &&RiAbsoluteStr<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<&'_ RiReferenceStr<T>> for RiString<S>
impl<S: Spec, T: Spec> PartialOrd<&'_ RiReferenceStr<T>> for RiString<S>
sourcefn partial_cmp(&self, o: &&RiReferenceStr<T>) -> Option<Ordering>
fn partial_cmp(&self, o: &&RiReferenceStr<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<&'_ RiStr<S>> for RiString<T>
impl<S: Spec, T: Spec> PartialOrd<&'_ RiStr<S>> for RiString<T>
sourcefn partial_cmp(&self, o: &&RiStr<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &&RiStr<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec> PartialOrd<&'_ str> for RiString<S>
impl<S: Spec> PartialOrd<&'_ str> for RiString<S>
sourcefn partial_cmp(&self, o: &&str) -> Option<Ordering>
fn partial_cmp(&self, o: &&str) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<Cow<'_, RiAbsoluteStr<S>>> for RiString<T>
impl<S: Spec, T: Spec> PartialOrd<Cow<'_, RiAbsoluteStr<S>>> for RiString<T>
sourcefn partial_cmp(&self, o: &Cow<'_, RiAbsoluteStr<S>>) -> Option<Ordering>
fn partial_cmp(&self, o: &Cow<'_, RiAbsoluteStr<S>>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<Cow<'_, RiReferenceStr<T>>> for RiString<S>
impl<S: Spec, T: Spec> PartialOrd<Cow<'_, RiReferenceStr<T>>> for RiString<S>
sourcefn partial_cmp(&self, o: &Cow<'_, RiReferenceStr<T>>) -> Option<Ordering>
fn partial_cmp(&self, o: &Cow<'_, RiReferenceStr<T>>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<Cow<'_, RiStr<S>>> for RiString<T>
impl<S: Spec, T: Spec> PartialOrd<Cow<'_, RiStr<S>>> for RiString<T>
sourcefn partial_cmp(&self, o: &Cow<'_, RiStr<S>>) -> Option<Ordering>
fn partial_cmp(&self, o: &Cow<'_, RiStr<S>>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec> PartialOrd<Cow<'_, str>> for RiString<S>
impl<S: Spec> PartialOrd<Cow<'_, str>> for RiString<S>
sourcefn partial_cmp(&self, o: &Cow<'_, str>) -> Option<Ordering>
fn partial_cmp(&self, o: &Cow<'_, str>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiAbsoluteStr<S>> for RiString<T>
impl<S: Spec, T: Spec> PartialOrd<RiAbsoluteStr<S>> for RiString<T>
sourcefn partial_cmp(&self, o: &RiAbsoluteStr<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiAbsoluteStr<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiAbsoluteString<S>> for RiString<T>
impl<S: Spec, T: Spec> PartialOrd<RiAbsoluteString<S>> for RiString<T>
sourcefn partial_cmp(&self, o: &RiAbsoluteString<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiAbsoluteString<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiReferenceStr<T>> for RiString<S>
impl<S: Spec, T: Spec> PartialOrd<RiReferenceStr<T>> for RiString<S>
sourcefn partial_cmp(&self, o: &RiReferenceStr<T>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiReferenceStr<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiReferenceString<T>> for RiString<S>
impl<S: Spec, T: Spec> PartialOrd<RiReferenceString<T>> for RiString<S>
sourcefn partial_cmp(&self, o: &RiReferenceString<T>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiReferenceString<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiStr<S>> for RiString<T>
impl<S: Spec, T: Spec> PartialOrd<RiStr<S>> for RiString<T>
sourcefn partial_cmp(&self, o: &RiStr<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiStr<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec> PartialOrd<RiString<S>> for str
impl<S: Spec> PartialOrd<RiString<S>> for str
sourcefn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec> PartialOrd<RiString<S>> for &str
impl<S: Spec> PartialOrd<RiString<S>> for &str
sourcefn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec> PartialOrd<RiString<S>> for Cow<'_, str>
impl<S: Spec> PartialOrd<RiString<S>> for Cow<'_, str>
sourcefn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec> PartialOrd<RiString<S>> for String
impl<S: Spec> PartialOrd<RiString<S>> for String
sourcefn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiString<S>> for RiReferenceStr<T>
impl<S: Spec, T: Spec> PartialOrd<RiString<S>> for RiReferenceStr<T>
sourcefn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiString<S>> for &RiReferenceStr<T>
impl<S: Spec, T: Spec> PartialOrd<RiString<S>> for &RiReferenceStr<T>
sourcefn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiString<S>> for Cow<'_, RiReferenceStr<T>>
impl<S: Spec, T: Spec> PartialOrd<RiString<S>> for Cow<'_, RiReferenceStr<T>>
sourcefn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiString<S>> for RiReferenceString<T>
impl<S: Spec, T: Spec> PartialOrd<RiString<S>> for RiReferenceString<T>
sourcefn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiString<T>> for RiAbsoluteStr<S>
impl<S: Spec, T: Spec> PartialOrd<RiString<T>> for RiAbsoluteStr<S>
sourcefn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiString<T>> for &RiAbsoluteStr<S>
impl<S: Spec, T: Spec> PartialOrd<RiString<T>> for &RiAbsoluteStr<S>
sourcefn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiString<T>> for Cow<'_, RiAbsoluteStr<S>>
impl<S: Spec, T: Spec> PartialOrd<RiString<T>> for Cow<'_, RiAbsoluteStr<S>>
sourcefn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiString<T>> for RiAbsoluteString<S>
impl<S: Spec, T: Spec> PartialOrd<RiString<T>> for RiAbsoluteString<S>
sourcefn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiString<T>> for RiString<S>
impl<S: Spec, T: Spec> PartialOrd<RiString<T>> for RiString<S>
sourcefn partial_cmp(&self, other: &RiString<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &RiString<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiString<T>> for RiStr<S>
impl<S: Spec, T: Spec> PartialOrd<RiString<T>> for RiStr<S>
sourcefn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiString<T>> for &RiStr<S>
impl<S: Spec, T: Spec> PartialOrd<RiString<T>> for &RiStr<S>
sourcefn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec, T: Spec> PartialOrd<RiString<T>> for Cow<'_, RiStr<S>>
impl<S: Spec, T: Spec> PartialOrd<RiString<T>> for Cow<'_, RiStr<S>>
sourcefn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
fn partial_cmp(&self, o: &RiString<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec> PartialOrd<String> for RiString<S>
impl<S: Spec> PartialOrd<String> for RiString<S>
sourcefn partial_cmp(&self, o: &String) -> Option<Ordering>
fn partial_cmp(&self, o: &String) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec> PartialOrd<str> for RiString<S>
impl<S: Spec> PartialOrd<str> for RiString<S>
sourcefn partial_cmp(&self, o: &str) -> Option<Ordering>
fn partial_cmp(&self, o: &str) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: Spec> TryFrom<RiReferenceString<S>> for RiString<S>
impl<S: Spec> TryFrom<RiReferenceString<S>> for RiString<S>
type Error = CreationError<RiReferenceString<S>>
type Error = CreationError<RiReferenceString<S>>
The type returned in the event of a conversion error.
sourcefn try_from(s: RiReferenceString<S>) -> Result<Self, Self::Error>
fn try_from(s: RiReferenceString<S>) -> Result<Self, Self::Error>
Performs the conversion.
sourceimpl<S: Spec> TryFrom<RiString<S>> for RiAbsoluteString<S>
impl<S: Spec> TryFrom<RiString<S>> for RiAbsoluteString<S>
impl<S: Spec> Eq for RiString<S>
Auto Trait Implementations
impl<S> RefUnwindSafe for RiString<S>
impl<S> Send for RiString<S>
impl<S> Sync for RiString<S>
impl<S> Unpin for RiString<S>
impl<S> UnwindSafe for RiString<S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more