Function iri_string::resolve::resolve_normalize_whatwg
source · [−]pub fn resolve_normalize_whatwg<S: Spec>(
reference: impl AsRef<RiReferenceStr<S>>,
base: impl AsRef<RiAbsoluteStr<S>>
) -> Result<RiString<S>, TaskError<Infallible>>👎 Deprecated since 0.5.5:
Use try_resolve_normalize_whatwg() for non-panicking normalization
Expand description
Resolves and normalizes the IRI reference.
It is recommended to use methods such as
RiReferenceStr::try_resolve_normalize_whatwg_against() and
RiRelativeStr::try_resolve_normalize_whatwg_against(), rather than this
freestanding function.
If you are going to resolve multiple references against the common base,
consider using FixedBaseResolver.
Enabled by alloc or std feature.
Failures
This fails if memory allocation failed.
Examples
use iri_string::resolve::{try_resolve_normalize_whatwg, FixedBaseResolver};
use iri_string::task::ProcessAndWrite;
use iri_string::types::{IriAbsoluteStr, IriReferenceStr};
let base = IriAbsoluteStr::new("scheme:/path")?;
let reference = IriReferenceStr::new("..//not-a-host")?;
// Resolve and normalize `reference` against `base`.
let resolved = try_resolve_normalize_whatwg(reference, base)?;
assert_eq!(resolved, "scheme:/.//not-a-host");