Struct UriQualifiedName Copy item path Source pub struct UriQualifiedName();
Expand description Creates a new &UriQualifiedName
.
URIQualifiedName
has Q{uri}ncname
format.
UriQualifiedName
type validates NCName part, but does not validate URI part.
In most contexts, processors are not required to raise errors if a URI
is not lexically valid according to RFC3986 and RFC3987 .
See 2.4.5 URI Literals for details.
— XML Path Language (XPath) 3.1, 2 Basics
XPath 3.1 requires a statically known, valid URI in a BracedURILiteral.
An implementation may raise a static error err:XQST0046 if the value
of a Braced URI Literal is of nonzero length and is neither an
absolute URI nor a relative URI.
— XML Path Language (XPath) 3.1, 2.4.5 URI Literals
It is user’s responsibility to validate URI part if necessary.
§ Failures
Fails if the given string is not a valid URIQualifiedName
.
§ Examples
let name = UriQualifiedName::from_str("Q{http://example.com/}name" )? ;
assert_eq! (name, "Q{http://example.com/}name" );
assert_eq! (
UriQualifiedName::from_str("Q{}name" )? ,
"Q{}name" ,
"Empty URI is OK"
);
assert_eq! (
UriQualifiedName::from_str("Q{foo}bar" )? ,
"Q{foo}bar" ,
"URI is not validated"
);
assert! (
UriQualifiedName::from_str("foo" ).is_err(),
"URIQualifiedName has `Q{{uri}}ncname` format"
);
assert! (
UriQualifiedName::from_str("Q{http://example.com}foo:bar" ).is_err(),
"Colon is not allowed"
);
assert! (
UriQualifiedName::from_str("Q{foo{bar}qux" ).is_err(),
"URI part cannot have `{{` and `}}`"
);
Creates a new &UriQualifiedName
without validation.
§ Safety
The given string should be a valid URIQualifiedName
.
§ Examples
let name = unsafe {
UriQualifiedName::new_unchecked("Q{foo}bar" )
};
assert_eq! (name, "Q{foo}bar" );
Returns the string as &str
.
§ Examples
let name = UriQualifiedName::from_str("Q{foo}bar" )? ;
assert_eq! (name, "Q{foo}bar" );
let s: & str = name.as_str();
assert_eq! (s, "Q{foo}bar" );
Returns the length of the string in bytes.
§ Examples
let name = UriQualifiedName::from_str("Q{foo}bar" )? ;
assert_eq! (name.len(), "Q{foo}bar" .len());
Parses the leading UriQualifiedName
and returns the value and the rest input.
§ Exmaples
let input = "Q{foo}bar:012" ;
let expected = UriQualifiedName::from_str("Q{foo}bar" )
.expect("valid UriQualifiedName" );
assert_eq! (
UriQualifiedName::parse_next(input),
Ok ((expected, ":012" ))
);
let input = "012" ;
assert! (UriQualifiedName::parse_next(input).is_err());
Returns the URI.
Note that this is O(length) operation.
Consider using ParsedUriQualifiedName::uri
method if possible.
§ Examples
let name = UriQualifiedName::from_str("Q{foo}bar" )? ;
assert_eq! (name.uri(), "foo" );
let empty_uri = UriQualifiedName::from_str("Q{}foo" )? ;
assert_eq! (empty_uri.uri(), "" );
Returns the local name.
Note that this is O(length) operation.
Consider using ParsedUriQualifiedName::local_name
method if possible.
§ Examples
let name = UriQualifiedName::from_str("Q{foo}bar" )? ;
assert_eq! (name.local_name(), "bar" );
Returns a pair of the uri and the local name.
Note that this is O(length) operation.
Consider using ParsedUriQualifiedName::uri_and_local
method if possible.
§ Examples
use std::convert::TryFrom;
let name = UriQualifiedName::from_str("Q{foo}bar" )? ;
assert_eq! (name.uri_and_local(), (name.uri(), name.local_name()));
Converts a Box<UriQualifiedName>
into a Box<str>
without copying or allocating.
§ Examples
let name = UriQualifiedName::from_str("Q{foo}bar" )? ;
let boxed_name: Box<UriQualifiedName> = name.into();
assert_eq! (&* boxed_name, name);
let boxed_str: Box<str> = boxed_name.into_boxed_str();
assert_eq! (&* boxed_str, name.as_str());
Converts this type into a shared reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Formats the value using the given formatter.
Read more Formats the value using the given formatter.
Read more Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
This method returns an ordering between
self
and
other
values if one exists.
Read more Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (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 Tests less than (for
self
and
other
) and is used by the
<
operator.
Read more Tests less than or equal to (for
self
and
other
) and is used by the
<=
operator.
Read more Tests greater than (for
self
and
other
) and is used by the
>
operator.
Read more Tests greater than or equal to (for
self
and
other
) and is used by
the
>=
operator.
Read more The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more The type returned in the event of a conversion error.
Performs the conversion.
Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more