• Home
  • Raw
  • Download

Lines Matching +full:whatwg +full:- +full:url

1 // Copyright 2013-2016 The rust-url developers.
3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
29 fn from(host: Host<String>) -> HostInternal { in from()
39 /// The host name of an URL.
43 /// A DNS domain name, as '.' dot-separated labels.
44 /// Non-ASCII labels are encoded in punycode per IDNA if this is the host of
45 /// a special URL, or percent encoded for non-special URLs. Hosts for
46 /// non-special URLs are also called opaque hosts.
50 /// `Url::host_str` returns the serialization of this address,
55 /// `Url::host_str` returns the serialization of that address between `[` and `]` brackets,
63 /// Return a copy of `self` that owns an allocated `String` but does not borrow an `&Url`.
64 pub fn to_owned(&self) -> Host<String> { in to_owned()
76 /// <https://url.spec.whatwg.org/#host-parsing>
77 pub fn parse(input: &str) -> Result<Self, ParseError> { in parse()
82 return parse_ipv6addr(&input[1..input.len() - 1]).map(Host::Ipv6); in parse()
124 // <https://url.spec.whatwg.org/#concept-opaque-host-parser>
125 pub fn parse_opaque(input: &str) -> Result<Self, ParseError> { in parse_opaque()
130 return parse_ipv6addr(&input[1..input.len() - 1]).map(Host::Ipv6); in parse_opaque()
165 fn domain_to_ascii(domain: &str) -> Result<String, ParseError> { in domain_to_ascii()
171 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { in fmt()
188 fn eq(&self, other: &Host<T>) -> bool { in eq()
198 fn write_ipv6(addr: &Ipv6Addr, f: &mut Formatter<'_>) -> fmt::Result { in write_ipv6()
223 // https://url.spec.whatwg.org/#concept-ipv6-serializer step 2 and 3
224 fn longest_zero_sequence(pieces: &[u16; 8]) -> (isize, isize) { in longest_zero_sequence()
225 let mut longest = -1;
226 let mut longest_length = -1;
227 let mut start = -1;
231 let length = $end - start;
246 start = -1;
250 // https://url.spec.whatwg.org/#concept-ipv6-serializer
253 (-1, -2)
259 /// <https://url.spec.whatwg.org/#ends-in-a-number-checker>
260 fn ends_in_a_number(input: &str) -> bool { in ends_in_a_number()
279 /// <https://url.spec.whatwg.org/#ipv4-number-parser>
281 fn parse_ipv4number(mut input: &str) -> Result<Option<u32>, ()> { in parse_ipv4number()
318 /// <https://url.spec.whatwg.org/#concept-ipv4-parser>
319 fn parse_ipv4addr(input: &str) -> ParseResult<Ipv4Addr> { in parse_ipv4addr()
335 let mut ipv4 = numbers.pop().expect("a non-empty list of numbers"); in parse_ipv4addr()
344 ipv4 += n << (8 * (3 - counter as u32)) in parse_ipv4addr()
349 /// <https://url.spec.whatwg.org/#concept-ipv6-parser>
350 fn parse_ipv6addr(input: &str) -> ParseResult<Ipv6Addr> { in parse_ipv6addr()
442 c @ b'0'..=b'9' => c - b'0', in parse_ipv6addr()
481 let mut swaps = piece_pointer - compress_pointer; in parse_ipv6addr()
484 pieces.swap(piece_pointer, compress_pointer + swaps - 1); in parse_ipv6addr()
485 swaps -= 1; in parse_ipv6addr()
486 piece_pointer -= 1; in parse_ipv6addr()