Skip to content

fluent-uri v0.2.0

Choose a tag to compare

@yescallop yescallop released this 30 Jul 17:24
· 138 commits to main since this release

Highlights

  • Added support for building, resolving and normalizing URI references.
  • Renamed Uri to UriRef because it represents a URI reference, not a URI (see #19).
  • Added a type parameter on EStr which represents an encoder determining which characters must be percent-encoded, along with 7 encoders: Userinfo, RegName, Port, Path, Query, Fragment, and Data.
  • Added EString which is a percent-encoded, growable string.
  • Dropped all unsafe code.

Other changes

Added

  • Implemented appropriate traits on all types.
  • Added Scheme::{new, new_or_panic} associated functions.
  • Added Authority::{port_to_u16, socket_addrs} utility methods.
  • Added Uri::has_{scheme, authority, query, fragment} and Authority::has_{userinfo, port} methods.
  • Added {EStr, Authority}::EMPTY constants.
  • Added EStr::{len, is_empty, rsplit_once} methods.
  • Added a type parameter on ParseError which represents the input type and ParseError::{into, strip}_input methods.
  • Added net and serde crate features.

Removed

  • Removed in-place mutable variant of URI reference (Uri<&mut [u8]>) and related APIs.
  • Removed ParseErrorKind enum and ParseError::{index, kind} methods.
  • Removed ipv_future and rfc6874bis crate features.
  • Removed Uri<&str>::dup method as UriRef<&str> is now Copy.
  • Removed Scheme::{to_lowercase, eq_lowercase} methods in favor of the new case-insensitive PartialEq implementation on Scheme.

Changed

  • Merged Uri::parse and Uri::parse_from into UriRef::parse with generics.
  • Authority is now directly borrowed from the string instead of the UriRef.
  • Removed Uri::{is_relative, is_absolute} in favor of the newly added UriRef::is_uri.
  • Removed Host, renamed HostData to Host, changed Authority::host to return &str, and added Authority::host_parsed which returns Host.
  • Changed Host: Ipv6 is now a tuple variant with a single Ipv6Addr field, and IpvFuture is now a non-exhaustive unit variant.
  • Removed the dedicated Path type, moved the utility methods Path::{is_absolute, is_rootless, segments} onto EStr<Path>, and changed UriRef::path to return &EStr<Path>.
  • Changed Authority::port to return Option<&EStr<Port>>.
  • Changed UriRef<String>::borrow to return UriRef<&str>.
  • Changed EStr::new to return Option instead and added EStr::new_or_panic.
  • Changed module structure.
  • Extracted a code pattern into the borrow-or-share crate.
  • Bumped MSRV to 1.65 (was 1.59).
  • Reworked documentation.