Struct url::ParseOptions
source · [−]pub struct ParseOptions<'a> { /* private fields */ }
Expand description
Full configuration for the URL parser.
Implementations
sourceimpl<'a> ParseOptions<'a>
impl<'a> ParseOptions<'a>
sourcepub fn encoding_override(self, new: EncodingOverride<'a>) -> Self
pub fn encoding_override(self, new: EncodingOverride<'a>) -> Self
Override the character encoding of query strings. This is a legacy concept only relevant for HTML.
sourcepub fn syntax_violation_callback(
self,
new: Option<&'a dyn Fn(SyntaxViolation)>
) -> Self
pub fn syntax_violation_callback(
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};
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));
Trait Implementations
sourceimpl<'a> Clone for ParseOptions<'a>
impl<'a> Clone for ParseOptions<'a>
sourcefn clone(&self) -> ParseOptions<'a>
fn clone(&self) -> ParseOptions<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a> Copy for ParseOptions<'a>
Auto Trait Implementations
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>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more