Struct RiQueryStr
struct RiQueryStr<S> { ... }
A borrowed slice of an IRI query (i.e. after the first ? and before the first #).
This corresponds to iquery rule in RFC 3987 (and query rule in RFC 3986).
The rule for ifragment is *( ipchar / iprivate / "/" / "?" ).
Valid values
This type can have an IRI fragment.
Note that the IRI foo://bar/baz#qux has the fragment qux, not #qux.
# use IriFragmentStr;
assert!;
assert!;
assert!;
assert!;
assert!;
assert!;
assert!;
Some characters and sequences cannot used in a fragment.
# use IriFragmentStr;
// `<` and `>` cannot directly appear in an IRI reference.
assert!;
// Broken percent encoding cannot appear in an IRI reference.
assert!;
assert!;
// Hash sign `#` cannot appear in an IRI fragment.
assert!;
use IriQueryStr;
assert!;
assert!;
assert!;
assert!;
assert!;
assert!;
assert!;
// Question sign `?` can appear in an IRI query.
assert!;
Some characters and sequences cannot used in a query.
use IriQueryStr;
// `<` and `>` cannot directly appear in an IRI reference.
assert!;
// Broken percent encoding cannot appear in an IRI reference.
assert!;
assert!;
// Hash sign `#` cannot appear in an IRI query.
assert!;
Implementations
impl RiQueryStr<IriSpec>
fn encode_to_uri(self: &Self) -> MappedToUri<'_, Self>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]crate::convert::MappedToUritype.Examples
# use Error; # # Ok::fn as_uri(self: &Self) -> Option<&UriQueryStr>Converts an IRI into a URI without modification, if possible.
This is semantically equivalent to
UriQueryStr::new(self.as_str()).ok().Examples
# use Error; use ; let ascii_iri = new?; assert_eq!; let nonascii_iri = new?; assert_eq!; # Ok::
impl<S: Spec> RiQueryStr<S>
fn from_prefixed(s: &str) -> Result<&Self, Error>Creates a new
&RiQueryStrfrom the query part prefixed by?.Examples
# use IriQueryStr; assert!; assert!; assert!; assert!; assert!; assert!; assert!; // Question sign `?` can appear in an IRI query. assert!; // `<` and `>` cannot directly appear in an IRI. assert!; // Broken percent encoding cannot appear in an IRI. assert!; assert!; // `?` prefix is expected. assert!; assert!; // Hash sign `#` cannot appear in an IRI query. assert!;
impl<S: crate::spec::Spec> RiQueryStr<S>
fn new(s: &str) -> Result<&Self, Error>Creates a new string.
unsafe fn new_unchecked(s: &str) -> &SelfCreates a new string without validation.
This does not validate the given string, so it is caller's responsibility to ensure the given string is valid.
Safety
The given string must be syntactically valid as
Selftype. If not, any use of the returned value or the call of this function itself may result in undefined behavior.fn as_str(self: &Self) -> &strReturns
&str.fn len(self: &Self) -> usizeReturns the string length.
fn is_empty(self: &Self) -> boolReturns whether the string is empty.
impl<S> Freeze for RiQueryStr<S>
impl<S> RefUnwindSafe for RiQueryStr<S>
impl<S> Send for RiQueryStr<S>
impl<S> Sized for RiQueryStr<S>
impl<S> Sync for RiQueryStr<S>
impl<S> Unpin for RiQueryStr<S>
impl<S> UnsafeUnpin for RiQueryStr<S>
impl<S> UnwindSafe for RiQueryStr<S>
impl<S: crate::spec::Spec> AsRef for RiQueryStr<S>
fn as_ref(self: &Self) -> &RiQueryStr<S>
impl<S: crate::spec::Spec> AsRef for RiQueryStr<S>
fn as_ref(self: &Self) -> &str
impl<S: crate::spec::Spec> Debug for RiQueryStr<S>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<S: crate::spec::Spec> Display for RiQueryStr<S>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<S: crate::spec::Spec> Eq for RiQueryStr<S>
impl<S: crate::spec::Spec> Hash for RiQueryStr<S>
fn hash<H: core::hash::Hasher>(self: &Self, state: &mut H)
impl<S: crate::spec::Spec> Ord for RiQueryStr<S>
fn cmp(self: &Self, other: &Self) -> Ordering
impl<S: crate::spec::Spec> PartialEq for RiQueryStr<S>
fn eq(self: &Self, other: &Self) -> bool
impl<S: crate::spec::Spec> PartialEq for RiQueryStr<S>
fn eq(self: &Self, o: &Cow<'_, str>) -> bool
impl<S: crate::spec::Spec> PartialEq for RiQueryStr<S>
fn eq(self: &Self, o: &&str) -> bool
impl<S: crate::spec::Spec> PartialEq for RiQueryStr<S>
fn eq(self: &Self, o: &str) -> bool
impl<S: crate::spec::Spec> PartialOrd for RiQueryStr<S>
fn partial_cmp(self: &Self, o: &Cow<'_, str>) -> Option<Ordering>
impl<S: crate::spec::Spec> PartialOrd for RiQueryStr<S>
fn partial_cmp(self: &Self, o: &&str) -> Option<Ordering>
impl<S: crate::spec::Spec> PartialOrd for RiQueryStr<S>
fn partial_cmp(self: &Self, o: &str) -> Option<Ordering>
impl<S: crate::spec::Spec> PartialOrd for RiQueryStr<S>
fn partial_cmp(self: &Self, other: &Self) -> Option<Ordering>
impl<S: crate::spec::Spec> ToOwned for RiQueryStr<S>
fn to_owned(self: &Self) -> <Self as >::Owned
impl<S: crate::spec::Spec, T: crate::spec::Spec> PartialEq for RiQueryStr<S>
fn eq(self: &Self, o: &RiQueryString<T>) -> bool
impl<S: crate::spec::Spec, T: crate::spec::Spec> PartialEq for RiQueryStr<T>
fn eq(self: &Self, o: &&RiQueryStr<S>) -> bool
impl<S: crate::spec::Spec, T: crate::spec::Spec> PartialOrd for RiQueryStr<S>
fn partial_cmp(self: &Self, o: &RiQueryString<T>) -> Option<Ordering>
impl<S: crate::spec::Spec, T: crate::spec::Spec> PartialOrd for RiQueryStr<T>
fn partial_cmp(self: &Self, o: &&RiQueryStr<S>) -> Option<Ordering>
impl<T> Any for RiQueryStr<S>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for RiQueryStr<S>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for RiQueryStr<S>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> ToString for RiQueryStr<S>
fn to_string(self: &Self) -> String