Struct url::parser::Parser

source ·
pub struct Parser<'a> {
    pub serialization: String,
    pub base_url: Option<&'a Url>,
    pub query_encoding_override: EncodingOverride<'a>,
    pub violation_fn: Option<&'a dyn Fn(SyntaxViolation)>,
    pub context: Context,
}

Fields§

§serialization: String§base_url: Option<&'a Url>§query_encoding_override: EncodingOverride<'a>§violation_fn: Option<&'a dyn Fn(SyntaxViolation)>§context: Context

Implementations§

source§

impl<'a> Parser<'a>

source

fn log_violation(&self, v: SyntaxViolation)

source

fn log_violation_if(&self, v: SyntaxViolation, test: impl FnOnce() -> bool)

source

pub fn for_setter(serialization: String) -> Parser<'a>

source

pub fn parse_url(self, input: &str) -> Result<Url, ParseError>

https://url.spec.whatwg.org/#concept-basic-url-parser

source

pub fn parse_scheme<'i>(&mut self, input: Input<'i>) -> Result<Input<'i>, ()>

source

fn parse_with_scheme(self, input: Input<'_>) -> Result<Url, ParseError>

source

fn parse_non_special( self, input: Input<'_>, scheme_type: SchemeType, scheme_end: u32 ) -> Result<Url, ParseError>

Scheme other than file, http, https, ws, ws, ftp.

source

fn parse_file( self, input: Input<'_>, scheme_type: SchemeType, base_file_url: Option<&Url> ) -> Result<Url, ParseError>

source

fn parse_relative( self, input: Input<'_>, scheme_type: SchemeType, base_url: &Url ) -> Result<Url, ParseError>

source

fn after_double_slash( self, input: Input<'_>, scheme_type: SchemeType, scheme_end: u32 ) -> Result<Url, ParseError>

source

fn parse_userinfo<'i>( &mut self, input: Input<'i>, scheme_type: SchemeType ) -> Result<(u32, Input<'i>), ParseError>

Return (username_end, remaining)

source

fn parse_host_and_port<'i>( &mut self, input: Input<'i>, scheme_end: u32, scheme_type: SchemeType ) -> Result<(u32, HostInternal, Option<u16>, Input<'i>), ParseError>

source

pub fn parse_host( input: Input<'_>, scheme_type: SchemeType ) -> Result<(Host<String>, Input<'_>), ParseError>

source

fn get_file_host( input: Input<'_> ) -> Result<(Host<String>, Input<'_>), ParseError>

source

fn parse_file_host<'i>( &mut self, input: Input<'i> ) -> Result<(bool, HostInternal, Input<'i>), ParseError>

source

pub fn file_host( input: Input<'_> ) -> Result<(bool, String, Input<'_>), ParseError>

source

pub fn parse_port<P>( input: Input<'_>, default_port: P, context: Context ) -> Result<(Option<u16>, Input<'_>), ParseError>where P: Fn() -> Option<u16>,

source

pub fn parse_path_start<'i>( &mut self, scheme_type: SchemeType, has_host: &mut bool, input: Input<'i> ) -> Input<'i>

source

pub fn parse_path<'i>( &mut self, scheme_type: SchemeType, has_host: &mut bool, path_start: usize, input: Input<'i> ) -> Input<'i>

source

fn last_slash_can_be_removed(serialization: &str, path_start: usize) -> bool

source

fn shorten_path(&mut self, scheme_type: SchemeType, path_start: usize)

https://url.spec.whatwg.org/#shorten-a-urls-path

source

fn pop_path(&mut self, scheme_type: SchemeType, path_start: usize)

https://url.spec.whatwg.org/#pop-a-urls-path

source

pub fn parse_cannot_be_a_base_path<'i>(&mut self, input: Input<'i>) -> Input<'i>

source

fn with_query_and_fragment( self, scheme_type: SchemeType, scheme_end: u32, username_end: u32, host_start: u32, host_end: u32, host: HostInternal, port: Option<u16>, path_start: u32, remaining: Input<'_> ) -> Result<Url, ParseError>

source

fn parse_query_and_fragment( &mut self, scheme_type: SchemeType, scheme_end: u32, input: Input<'_> ) -> Result<(Option<u32>, Option<u32>), ParseError>

Return (query_start, fragment_start)

source

pub fn parse_query<'i>( &mut self, scheme_type: SchemeType, scheme_end: u32, input: Input<'i> ) -> Option<Input<'i>>

source

fn fragment_only( self, base_url: &Url, input: Input<'_> ) -> Result<Url, ParseError>

source

pub fn parse_fragment(&mut self, input: Input<'_>)

source

fn check_url_code_point(&self, c: char, input: &Input<'_>)

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Parser<'a>

§

impl<'a> !Send for Parser<'a>

§

impl<'a> !Sync for Parser<'a>

§

impl<'a> Unpin for Parser<'a>

§

impl<'a> !UnwindSafe for Parser<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.