Struct iri_string::types::RiString [−][src]
pub struct RiString<S> { /* fields omitted */ }
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
Shrinks the capacity of the inner buffer to match its length.
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);
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");
Sets the fragment part to the given string.
Removes fragment part (and following #
character) if None
is given.
Methods from Deref<Target = RiStr<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);
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");
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);
Trait Implementations
Performs the conversion.
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
Performs the conversion.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
type Error = CreationError<RiReferenceString<S>>
type Error = CreationError<RiReferenceString<S>>
The type returned in the event of a conversion error.
Performs the conversion.
Auto Trait Implementations
impl<S> RefUnwindSafe for RiString<S>
impl<S> UnwindSafe for RiString<S>
Blanket Implementations
Mutably borrows from an owned value. Read more