Debian Codegraph @

src/lib.rs

raw symbols SCIP
1 #![warn(
2 future_incompatible,
3 missing_debug_implementations,
4 missing_docs,
5 nonstandard_style,
6 rust_2018_idioms,
7 clippy::checked_conversions,
8 clippy::if_not_else,
9 clippy::ignored_unit_patterns,
10 clippy::map_unwrap_or,
11 clippy::missing_errors_doc,
12 clippy::must_use_candidate,
13 // clippy::redundant_closure_for_method_calls,
14 clippy::redundant_else,
15 clippy::semicolon_if_nothing_returned,
16 // clippy::single_match_else,
17 clippy::use_self,
18 )]
19 #![forbid(unsafe_code)]
20 #![cfg_attr(docsrs, feature(doc_cfg))]
21 #![no_std]
22
23 //! A generic URI/IRI handling library compliant with [RFC 3986] and [RFC 3987].
24 //!
25 //! [RFC 3986]: https://datatracker.ietf.org/doc/html/rfc3986
26 //! [RFC 3987]: https://datatracker.ietf.org/doc/html/rfc3987
27 //!
28 //! **Examples:** [Parsing](Uri#examples). [Building](build::Builder#examples).
29 //! [Reference resolution](UriRef::resolve_against). [Normalization](Uri::normalize).
30 //! [Percent-decoding](crate::pct_enc::EStr#examples).
31 //! [Percent-encoding](crate::pct_enc::EString#examples).
32 //!
33 //! # Terminology
34 //!
35 //! A *[URI reference]* is either a *[URI]* or a *[relative reference]*. If it starts with a *[scheme]*
36 //! (like `http`, `ftp`, `mailto`, etc.) followed by a colon (`:`), it is a URI. For example,
37 //! `http://example.com/` and `mailto:[email protected]` are URIs. Otherwise, it is
38 //! a relative reference. For example, `//example.org/`, `/index.html`, `../`, `foo`,
39 //! `?bar`, and `#baz` are relative references.
40 //!
41 //! An *[IRI]* (reference) is an internationalized version of URI (reference)
42 //! which may contain non-ASCII characters.
43 //!
44 //! [URI]: https://datatracker.ietf.org/doc/html/rfc3986#section-3
45 //! [URI reference]: https://datatracker.ietf.org/doc/html/rfc3986#section-4.1
46 //! [IRI]: https://datatracker.ietf.org/doc/html/rfc3987#section-2
47 //! [relative reference]: https://datatracker.ietf.org/doc/html/rfc3986#section-4.2
48 //! [scheme]: https://datatracker.ietf.org/doc/html/rfc3986#section-3.1
49 //!
50 //! # Guidance for crate users
51 //!
52 //! Advice for designers of new URI schemes can be found in [RFC 7595].
53 //! Guidance on the specification of URI substructure in standards
54 //! can be found in [RFC 8820]. The crate author recommends [RFC 9413]
55 //! for further reading as the long-term interoperability
56 //! of URI schemes may be of concern.
57 //!
58 //! [RFC 7595]: https://datatracker.ietf.org/doc/html/rfc7595
59 //! [RFC 8820]: https://datatracker.ietf.org/doc/html/rfc8820
60 //! [RFC 9413]: https://datatracker.ietf.org/doc/html/rfc9413
61 //!
62 //! # Crate features
63 //!
64 //! - `std` (default): Implies `alloc` and `impl-error`. Required for [`Authority::socket_addrs`].
65 //!
66 //! - `alloc`: Required for memory-allocating types and functions.
67 //!
68 //! - `impl-error`: Required for [`Error`] implementations. Disabling `std`
69 //! while enabling `impl-error` requires a minimum Rust version of 1.81.
70 //!
71 //! - `net`: Required for IP address fields in [`Host`], for [`Builder::host`] to
72 //! take an IP address as argument, and for [`Authority::socket_addrs`].
73 //! Disabling `std` while enabling `net` requires a minimum Rust version of 1.77.
74 //!
75 //! - `serde`: Required for [`Serialize`] and [`Deserialize`] implementations.
76 //!
77 //! [`Host`]: component::Host
78 //! [`Builder::host`]: build::Builder::host
79 //! [`Authority::socket_addrs`]: component::Authority::socket_addrs
80 //! [`Error`]: core::error::Error
81 //! [`Serialize`]: serde::Serialize
82 //! [`Deserialize`]: serde::Deserialize
83
84 #[cfg(feature = "alloc")]
85 pub mod buildrust-analyzer cargo fluent-uri 0.4.1 build/;
86 pub mod componentrust-analyzer cargo fluent-uri 0.4.1 component/;
87 mod convertrust-analyzer cargo fluent-uri 0.4.1 convert/;
88 mod fmtrust-analyzer cargo fluent-uri 0.4.1 fmt/;
89 mod imprust-analyzer cargo fluent-uri 0.4.1 imp/;
90 #[cfg(feature = "alloc")]
91 pub mod normalizerust-analyzer cargo fluent-uri 0.4.1 normalize/;
92 mod parserust-analyzer cargo fluent-uri 0.4.1 parse/;
93 pub mod pct_encrust-analyzer cargo fluent-uri 0.4.1 pct_enc/;
94 #[cfg(feature = "alloc")]
95 pub mod resolverust-analyzer cargo fluent-uri 0.4.1 resolve/;
96 mod utf8rust-analyzer cargo fluent-uri 0.4.1 utf8/;
97
98 pub use convertrust-analyzer cargo fluent-uri 0.4.1 convert/::ConvertErrorrust-analyzer cargo fluent-uri 0.4.1 convert/ConvertError#;
99 pub use imprust-analyzer cargo fluent-uri 0.4.1 imp/::{Irirust-analyzer cargo fluent-uri 0.4.1 imp/Iri#, IriRefrust-analyzer cargo fluent-uri 0.4.1 imp/IriRef#, Urirust-analyzer cargo fluent-uri 0.4.1 imp/Uri#, UriRefrust-analyzer cargo fluent-uri 0.4.1 imp/UriRef#};
100 pub use parserust-analyzer cargo fluent-uri 0.4.1 parse/::{ParseErrorrust-analyzer cargo fluent-uri 0.4.1 parse/ParseError#, ParseErrorKindrust-analyzer cargo fluent-uri 0.4.1 parse/ParseErrorKind#};
101
102 #[cfg(feature = "std")]
103 extern crate stdrust-analyzer cargo fluent-uri 0.4.1 std/;
104
105 #[cfg(feature = "alloc")]
106 extern crate allocrust-analyzer cargo fluent-uri 0.4.1 alloc/;
107
108 #[cfg(all(feature = "net", not(feature = "std")))]
109 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::netrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/;
110 #[cfg(all(feature = "net", feature = "std"))]
111 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::netrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/;
112
113 #[cfg(all(feature = "impl-error", not(feature = "std")))]
114 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#;
115 #[cfg(all(feature = "impl-error", feature = "std"))]
116 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#;