1#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg))]
2#![doc = include_str!("../README.md")]
3// @@ begin lint list maintained by maint/add_warning @@
4#![allow(renamed_and_removed_lints)] // @@REMOVE_WHEN(ci_arti_stable)
5#![allow(unknown_lints)] // @@REMOVE_WHEN(ci_arti_nightly)
6#![warn(missing_docs)]
7#![warn(noop_method_call)]
8#![warn(unreachable_pub)]
9#![warn(clippy::all)]
10#![deny(clippy::await_holding_lock)]
11#![deny(clippy::cargo_common_metadata)]
12#![deny(clippy::cast_lossless)]
13#![deny(clippy::checked_conversions)]
14#![warn(clippy::cognitive_complexity)]
15#![deny(clippy::debug_assert_with_mut_call)]
16#![deny(clippy::exhaustive_enums)]
17#![deny(clippy::exhaustive_structs)]
18#![deny(clippy::expl_impl_clone_on_copy)]
19#![deny(clippy::fallible_impl_from)]
20#![deny(clippy::implicit_clone)]
21#![deny(clippy::large_stack_arrays)]
22#![warn(clippy::manual_ok_or)]
23#![deny(clippy::missing_docs_in_private_items)]
24#![warn(clippy::needless_borrow)]
25#![warn(clippy::needless_pass_by_value)]
26#![warn(clippy::option_option)]
27#![deny(clippy::print_stderr)]
28#![deny(clippy::print_stdout)]
29#![warn(clippy::rc_buffer)]
30#![deny(clippy::ref_option_ref)]
31#![warn(clippy::semicolon_if_nothing_returned)]
32#![warn(clippy::trait_duplication_in_bounds)]
33#![deny(clippy::unchecked_duration_subtraction)]
34#![deny(clippy::unnecessary_wraps)]
35#![warn(clippy::unseparated_literal_suffix)]
36#![deny(clippy::unwrap_used)]
37#![deny(clippy::mod_module_files)]
38#![allow(clippy::let_unit_value)] // This can reasonably be done for explicitness
39#![allow(clippy::uninlined_format_args)]
40#![allow(clippy::significant_drop_in_scrutinee)] // arti/-/merge_requests/588/#note_2812945
41#![allow(clippy::result_large_err)] // temporary workaround for arti#587
42#![allow(clippy::needless_raw_string_hashes)] // complained-about code is fine, often best
43#![allow(clippy::needless_lifetimes)] // See arti#1765
44//! <!-- @@ end lint list maintained by maint/add_warning @@ -->
4546// TODO #1645 (either remove this, or decide to have it everywhere)
47#![cfg_attr(not(all(feature = "full", feature = "experimental")), allow(unused))]
4849#[cfg(feature = "hs-service")]
50pub(crate) mod build;
51#[macro_use]
52pub(crate) mod parse;
53pub mod doc;
54mod err;
55pub mod types;
56mod util;
5758// Use `#[doc(hidden)]` rather than pub(crate), because otherwise the doctest
59// doesn't work.
60#[doc(hidden)]
61pub use util::batching_split_before;
6263pub use err::{BuildError, Error, NetdocErrorKind, Pos};
6465#[cfg(feature = "hs-service")]
66#[cfg_attr(docsrs, doc(cfg(feature = "hs-service")))]
67pub use build::NetdocBuilder;
6869/// Alias for the Result type returned by most objects in this module.
70pub type Result<T> = std::result::Result<T, Error>;
7172/// Alias for the Result type returned by document-builder functions in this
73/// module.
74pub type BuildResult<T> = std::result::Result<T, BuildError>;
7576/// Indicates whether we should parse an annotated list of objects or a
77/// non-annotated list.
78#[derive(PartialEq, Debug, Eq)]
79#[allow(clippy::exhaustive_enums)]
80pub enum AllowAnnotations {
81/// Parsing a document where items might be annotated.
82 ///
83 /// Annotations are a list of zero or more items with keywords
84 /// beginning with @ that precede the items that are actually part
85 /// of the document.
86AnnotationsAllowed,
87/// Parsing a document where annotations are not allowed.
88AnnotationsNotAllowed,
89}
9091/// Return a list of the protocols [supported](tor_protover::doc_supported)
92/// by this crate.
93pub fn supported_protocols() -> tor_protover::Protocols {
94use tor_protover::named::*;
95// WARNING: REMOVING ELEMENTS FROM THIS LIST CAN BE DANGEROUS!
96 // SEE [`tor_protover::doc_changing`]
97[
98 DESC_CROSSSIGN,
99 DESC_NO_TAP,
100 DESC_FAMILY_IDS,
101 MICRODESC_ED25519_KEY,
102 MICRODESC_NO_TAP,
103 CONS_ED25519_MDS,
104 ]
105 .into_iter()
106 .collect()
107}
108109#[cfg(test)]
110mod test {
111// @@ begin test lint list maintained by maint/add_warning @@
112#![allow(clippy::bool_assert_comparison)]
113 #![allow(clippy::clone_on_copy)]
114 #![allow(clippy::dbg_macro)]
115 #![allow(clippy::mixed_attributes_style)]
116 #![allow(clippy::print_stderr)]
117 #![allow(clippy::print_stdout)]
118 #![allow(clippy::single_char_pattern)]
119 #![allow(clippy::unwrap_used)]
120 #![allow(clippy::unchecked_duration_subtraction)]
121 #![allow(clippy::useless_vec)]
122 #![allow(clippy::needless_pass_by_value)]
123//! <!-- @@ end test lint list maintained by maint/add_warning @@ -->
124125use super::*;
126127#[test]
128fn protocols() {
129let pr = supported_protocols();
130let expected = "Cons=2 Desc=2-4 Microdesc=2-3".parse().unwrap();
131assert_eq!(pr, expected);
132 }
133}