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#![allow(mismatched_lifetime_syntaxes)] // temporary workaround for arti#2060
45//! <!-- @@ end lint list maintained by maint/add_warning @@ -->
4647// TODO #1645 (either remove this, or decide to have it everywhere)
48#![cfg_attr(not(all(feature = "full", feature = "experimental")), allow(unused))]
4950#[cfg(feature = "hs-service")]
51pub(crate) mod build;
52#[macro_use]
53pub(crate) mod parse;
54pub mod doc;
55mod err;
56pub mod types;
57mod util;
5859#[cfg(feature = "parse2")]
60pub mod parse2;
61#[doc(hidden)]
62pub use derive_deftly;
6364// Use `#[doc(hidden)]` rather than pub(crate), because otherwise the doctest
65// doesn't work.
66#[doc(hidden)]
67pub use util::batching_split_before;
6869pub use err::{BuildError, Error, NetdocErrorKind, Pos};
7071#[cfg(feature = "hs-service")]
72#[cfg_attr(docsrs, doc(cfg(feature = "hs-service")))]
73pub use build::NetdocBuilder;
7475/// Alias for the Result type returned by most objects in this module.
76pub type Result<T> = std::result::Result<T, Error>;
7778/// Alias for the Result type returned by document-builder functions in this
79/// module.
80pub type BuildResult<T> = std::result::Result<T, BuildError>;
8182/// Indicates whether we should parse an annotated list of objects or a
83/// non-annotated list.
84#[derive(PartialEq, Debug, Eq)]
85#[allow(clippy::exhaustive_enums)]
86pub enum AllowAnnotations {
87/// Parsing a document where items might be annotated.
88 ///
89 /// Annotations are a list of zero or more items with keywords
90 /// beginning with @ that precede the items that are actually part
91 /// of the document.
92AnnotationsAllowed,
93/// Parsing a document where annotations are not allowed.
94AnnotationsNotAllowed,
95}
9697/// Return a list of the protocols [supported](tor_protover::doc_supported)
98/// by this crate.
99pub fn supported_protocols() -> tor_protover::Protocols {
100use tor_protover::named::*;
101// WARNING: REMOVING ELEMENTS FROM THIS LIST CAN BE DANGEROUS!
102 // SEE [`tor_protover::doc_changing`]
103[
104 DESC_CROSSSIGN,
105 DESC_NO_TAP,
106 DESC_FAMILY_IDS,
107 MICRODESC_ED25519_KEY,
108 MICRODESC_NO_TAP,
109 CONS_ED25519_MDS,
110 ]
111 .into_iter()
112 .collect()
113}
114115#[cfg(test)]
116mod test {
117// @@ begin test lint list maintained by maint/add_warning @@
118#![allow(clippy::bool_assert_comparison)]
119 #![allow(clippy::clone_on_copy)]
120 #![allow(clippy::dbg_macro)]
121 #![allow(clippy::mixed_attributes_style)]
122 #![allow(clippy::print_stderr)]
123 #![allow(clippy::print_stdout)]
124 #![allow(clippy::single_char_pattern)]
125 #![allow(clippy::unwrap_used)]
126 #![allow(clippy::unchecked_duration_subtraction)]
127 #![allow(clippy::useless_vec)]
128 #![allow(clippy::needless_pass_by_value)]
129//! <!-- @@ end test lint list maintained by maint/add_warning @@ -->
130131use super::*;
132133#[test]
134fn protocols() {
135let pr = supported_protocols();
136let expected = "Cons=2 Desc=2-4 Microdesc=2-3".parse().unwrap();
137assert_eq!(pr, expected);
138 }
139}