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>
impl<'a> Parser<'a>
fn log_violation(&self, v: SyntaxViolation)
fn log_violation_if(&self, v: SyntaxViolation, test: impl FnOnce() -> bool)
pub fn for_setter(serialization: String) -> Parser<'a>
sourcepub fn parse_url(self, input: &str) -> Result<Url, ParseError>
pub fn parse_url(self, input: &str) -> Result<Url, ParseError>
https://url.spec.whatwg.org/#concept-basic-url-parser
pub fn parse_scheme<'i>(&mut self, input: Input<'i>) -> Result<Input<'i>, ()>
fn parse_with_scheme(self, input: Input<'_>) -> Result<Url, ParseError>
sourcefn parse_non_special(
self,
input: Input<'_>,
scheme_type: SchemeType,
scheme_end: u32,
) -> Result<Url, ParseError>
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.
fn parse_file( self, input: Input<'_>, scheme_type: SchemeType, base_file_url: Option<&Url>, ) -> Result<Url, ParseError>
fn parse_relative( self, input: Input<'_>, scheme_type: SchemeType, base_url: &Url, ) -> Result<Url, ParseError>
fn after_double_slash( self, input: Input<'_>, scheme_type: SchemeType, scheme_end: u32, ) -> Result<Url, ParseError>
sourcefn parse_userinfo<'i>(
&mut self,
input: Input<'i>,
scheme_type: SchemeType,
) -> Result<(u32, Input<'i>), ParseError>
fn parse_userinfo<'i>( &mut self, input: Input<'i>, scheme_type: SchemeType, ) -> Result<(u32, Input<'i>), ParseError>
Return (username_end, remaining)
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>
pub fn parse_host( input: Input<'_>, scheme_type: SchemeType, ) -> Result<(Host<String>, Input<'_>), ParseError>
fn get_file_host( input: Input<'_>, ) -> Result<(Host<String>, Input<'_>), ParseError>
fn parse_file_host<'i>( &mut self, input: Input<'i>, ) -> Result<(bool, HostInternal, Input<'i>), ParseError>
pub fn file_host( input: Input<'_>, ) -> Result<(bool, String, Input<'_>), ParseError>
pub fn parse_port<P>( input: Input<'_>, default_port: P, context: Context, ) -> Result<(Option<u16>, Input<'_>), ParseError>
pub fn parse_path_start<'i>( &mut self, scheme_type: SchemeType, has_host: &mut bool, input: Input<'i>, ) -> Input<'i> ⓘ
pub fn parse_path<'i>( &mut self, scheme_type: SchemeType, has_host: &mut bool, path_start: usize, input: Input<'i>, ) -> Input<'i> ⓘ
fn last_slash_can_be_removed(serialization: &str, path_start: usize) -> bool
sourcefn shorten_path(&mut self, scheme_type: SchemeType, path_start: usize)
fn shorten_path(&mut self, scheme_type: SchemeType, path_start: usize)
https://url.spec.whatwg.org/#shorten-a-urls-path
sourcefn pop_path(&mut self, scheme_type: SchemeType, path_start: usize)
fn pop_path(&mut self, scheme_type: SchemeType, path_start: usize)
https://url.spec.whatwg.org/#pop-a-urls-path
pub fn parse_cannot_be_a_base_path<'i>(&mut self, input: Input<'i>) -> Input<'i> ⓘ
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>
sourcefn parse_query_and_fragment(
&mut self,
scheme_type: SchemeType,
scheme_end: u32,
input: Input<'_>,
) -> Result<(Option<u32>, Option<u32>), ParseError>
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)
pub fn parse_query<'i>( &mut self, scheme_type: SchemeType, scheme_end: u32, input: Input<'i>, ) -> Option<Input<'i>>
fn fragment_only( self, base_url: &Url, input: Input<'_>, ) -> Result<Url, ParseError>
pub fn parse_fragment(&mut self, input: Input<'_>)
fn check_url_code_point(&self, c: char, input: &Input<'_>)
Auto Trait Implementations§
impl<'a> Freeze for Parser<'a>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more