Struct RiFragmentStr
struct RiFragmentStr<S> { ... }
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.
# 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!;
Implementations
impl RiFragmentStr<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<&UriFragmentStr>Converts an IRI into a URI without modification, if possible.
This is semantically equivalent to
UriFragmentStr::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> RiFragmentStr<S>
fn from_prefixed(s: &str) -> Result<&Self, Error>Creates a new
&RiFragmentStrfrom the fragment part prefixed by#.Examples
# use IriFragmentStr; assert!; assert!; assert!; assert!; assert!; assert!; 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 fragment. assert!;
impl<S: crate::spec::Spec> RiFragmentStr<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 RiFragmentStr<S>
impl<S> RefUnwindSafe for RiFragmentStr<S>
impl<S> Send for RiFragmentStr<S>
impl<S> Sized for RiFragmentStr<S>
impl<S> Sync for RiFragmentStr<S>
impl<S> Unpin for RiFragmentStr<S>
impl<S> UnsafeUnpin for RiFragmentStr<S>
impl<S> UnwindSafe for RiFragmentStr<S>
impl<S: crate::spec::Spec> AsRef for RiFragmentStr<S>
fn as_ref(self: &Self) -> &RiFragmentStr<S>
impl<S: crate::spec::Spec> AsRef for RiFragmentStr<S>
fn as_ref(self: &Self) -> &str
impl<S: crate::spec::Spec> Debug for RiFragmentStr<S>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<S: crate::spec::Spec> Display for RiFragmentStr<S>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<S: crate::spec::Spec> Eq for RiFragmentStr<S>
impl<S: crate::spec::Spec> Hash for RiFragmentStr<S>
fn hash<H: core::hash::Hasher>(self: &Self, state: &mut H)
impl<S: crate::spec::Spec> Ord for RiFragmentStr<S>
fn cmp(self: &Self, other: &Self) -> Ordering
impl<S: crate::spec::Spec> PartialEq for RiFragmentStr<S>
fn eq(self: &Self, other: &Self) -> bool
impl<S: crate::spec::Spec> PartialEq for RiFragmentStr<S>
fn eq(self: &Self, o: &Cow<'_, str>) -> bool
impl<S: crate::spec::Spec> PartialEq for RiFragmentStr<S>
fn eq(self: &Self, o: &&str) -> bool
impl<S: crate::spec::Spec> PartialEq for RiFragmentStr<S>
fn eq(self: &Self, o: &str) -> bool
impl<S: crate::spec::Spec> PartialOrd for RiFragmentStr<S>
fn partial_cmp(self: &Self, other: &Self) -> Option<Ordering>
impl<S: crate::spec::Spec> PartialOrd for RiFragmentStr<S>
fn partial_cmp(self: &Self, o: &Cow<'_, str>) -> Option<Ordering>
impl<S: crate::spec::Spec> PartialOrd for RiFragmentStr<S>
fn partial_cmp(self: &Self, o: &&str) -> Option<Ordering>
impl<S: crate::spec::Spec> PartialOrd for RiFragmentStr<S>
fn partial_cmp(self: &Self, o: &str) -> Option<Ordering>
impl<S: crate::spec::Spec> ToOwned for RiFragmentStr<S>
fn to_owned(self: &Self) -> <Self as >::Owned
impl<S: crate::spec::Spec, T: crate::spec::Spec> PartialEq for RiFragmentStr<S>
fn eq(self: &Self, o: &RiFragmentString<T>) -> bool
impl<S: crate::spec::Spec, T: crate::spec::Spec> PartialEq for RiFragmentStr<T>
fn eq(self: &Self, o: &&RiFragmentStr<S>) -> bool
impl<S: crate::spec::Spec, T: crate::spec::Spec> PartialOrd for RiFragmentStr<S>
fn partial_cmp(self: &Self, o: &RiFragmentString<T>) -> Option<Ordering>
impl<S: crate::spec::Spec, T: crate::spec::Spec> PartialOrd for RiFragmentStr<T>
fn partial_cmp(self: &Self, o: &&RiFragmentStr<S>) -> Option<Ordering>
impl<T> Any for RiFragmentStr<S>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for RiFragmentStr<S>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for RiFragmentStr<S>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> ToString for RiFragmentStr<S>
fn to_string(self: &Self) -> String