pub struct Uri { /* private fields */ }
Expand description

Lychee’s own representation of a URI, which encapsulates all supported formats.

If the scheme is mailto, it’s a mail address. Otherwise it’s treated as a website URL.

Implementations

Returns the string representation of the Uri.

If it’s an email address, returns the string with scheme stripped. Otherwise returns the string as-is.

Returns the scheme of the URI (e.g. http or mailto)

Returns the domain of the URI (e.g. example.com)

Unless this URL is cannot-be-a-base, return an iterator of ‘/’ slash-separated path segments, each as a percent-encoded ASCII string.

Return None for cannot-be-a-base URLs.

Returns the IP address (either IPv4 or IPv6) of the URI, or None if it is a domain

Check if the URI is a valid mail address

Check if the URI is a file

Returns true if this is a loopback address.

IPv4

This is a loopback address (127.0.0.0/8).

This property is defined by IETF RFC 1122.

IPv6

This is the loopback address (::1), as defined in IETF RFC 4291 section 2.5.3.

Returns true if this is a private IPv4 address, a unique local IPv6 address (fc00::/7).

IPv4

The private address ranges are defined in IETF RFC 1918 and include:

  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16
IPv6

Unique local address is defined in IETF RFC 4193.

Note

Unicast site-local network was defined in IETF RFC 4291, but was fully deprecated in IETF RFC 3879. So it is NOT considered as private on this purpose.

Returns true if the address is a link-local IPv4 address (169.254.0.0/16), or an IPv6 unicast address with link-local scope (fe80::/10).

IPv4

Link-local address is defined by IETF RFC 3927.

IPv6

Unicast address with link-local scope is defined in IETF RFC 4291.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more