Struct ParseOptions

struct ParseOptions<'a> { ... }

Full configuration for the URL parser.

Implementations

impl<'a> ParseOptions<'a>

fn base_url(self: Self, new: Option<&'a Url>) -> Self

Change the base URL

See the notes of Url::join for more details about how this base is considered when parsing.

fn encoding_override(self: Self, new: EncodingOverride<'a>) -> Self

Override the character encoding of query strings. This is a legacy concept only relevant for HTML.

fn syntax_violation_callback(self: Self, new: Option<&'a dyn Fn(SyntaxViolation)>) -> Self

Call the provided function or closure for a non-fatal SyntaxViolation when it occurs during parsing. Note that since the provided function is Fn, the caller might need to utilize interior mutability, such as with a RefCell, to collect the violations.

Example

use std::cell::RefCell;
use url::{Url, SyntaxViolation};
# use url::ParseError;
# fn run() -> Result<(), url::ParseError> {
let violations = RefCell::new(Vec::new());
let url = Url::options()
    .syntax_violation_callback(Some(&|v| violations.borrow_mut().push(v)))
    .parse("https:////example.com")?;
assert_eq!(url.as_str(), "https://example.com/");
assert_eq!(violations.into_inner(),
           vec!(SyntaxViolation::ExpectedDoubleSlash));
# Ok(())
# }
# run().unwrap();
fn parse(self: Self, input: &str) -> Result<Url, crate::ParseError>

Parse an URL string with the configuration so far.

impl<'a> Clone for ParseOptions<'a>

fn clone(self: &Self) -> ParseOptions<'a>

impl<'a> Copy for ParseOptions<'a>

impl<'a> Freeze for ParseOptions<'a>

impl<'a> RefUnwindSafe for ParseOptions<'a>

impl<'a> Send for ParseOptions<'a>

impl<'a> Sync for ParseOptions<'a>

impl<'a> Unpin for ParseOptions<'a>

impl<'a> UnwindSafe for ParseOptions<'a>

impl<T> Any for ParseOptions<'a>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for ParseOptions<'a>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for ParseOptions<'a>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for ParseOptions<'a>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> ErasedDestructor for ParseOptions<'a>

impl<T> From for ParseOptions<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for ParseOptions<'a>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for ParseOptions<'a>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for ParseOptions<'a>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for ParseOptions<'a>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>