cloudfront_logs/
lib.rs

1//! AWS CloudFront logs parser
2//!
3//! The log file format is described in the official documentation:
4//! <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html#LogFileFormat>
5
6#![cfg_attr(docsrs, feature(doc_auto_cfg))]
7#![forbid(unsafe_code)]
8#![warn(
9    clippy::all,
10    clippy::await_holding_lock,
11    clippy::char_lit_as_u8,
12    clippy::checked_conversions,
13    clippy::dbg_macro,
14    clippy::debug_assert_with_mut_call,
15    clippy::empty_enum,
16    clippy::enum_glob_use,
17    clippy::exit,
18    clippy::expl_impl_clone_on_copy,
19    clippy::explicit_deref_methods,
20    clippy::explicit_into_iter_loop,
21    clippy::fallible_impl_from,
22    clippy::filter_map_next,
23    clippy::flat_map_option,
24    clippy::float_cmp_const,
25    clippy::fn_params_excessive_bools,
26    clippy::from_iter_instead_of_collect,
27    clippy::if_let_mutex,
28    clippy::implicit_clone,
29    clippy::imprecise_flops,
30    clippy::inefficient_to_string,
31    clippy::invalid_upcast_comparisons,
32    clippy::large_digit_groups,
33    clippy::large_stack_arrays,
34    clippy::large_types_passed_by_value,
35    clippy::let_unit_value,
36    clippy::linkedlist,
37    clippy::lossy_float_literal,
38    clippy::macro_use_imports,
39    clippy::manual_ok_or,
40    clippy::map_err_ignore,
41    clippy::map_flatten,
42    clippy::map_unwrap_or,
43    clippy::match_on_vec_items,
44    clippy::match_same_arms,
45    clippy::match_wild_err_arm,
46    clippy::match_wildcard_for_single_variants,
47    clippy::mem_forget,
48    clippy::missing_enforced_import_renames,
49    clippy::mut_mut,
50    clippy::mutex_integer,
51    clippy::needless_borrow,
52    clippy::needless_continue,
53    clippy::needless_for_each,
54    clippy::option_option,
55    clippy::path_buf_push_overwrite,
56    clippy::ptr_as_ptr,
57    clippy::rc_mutex,
58    clippy::ref_option_ref,
59    clippy::rest_pat_in_fully_bound_structs,
60    clippy::same_functions_in_if_condition,
61    clippy::semicolon_if_nothing_returned,
62    clippy::single_match_else,
63    clippy::string_add_assign,
64    clippy::string_add,
65    clippy::string_lit_as_bytes,
66    clippy::string_to_string,
67    clippy::todo,
68    clippy::trait_duplication_in_bounds,
69    clippy::unimplemented,
70    clippy::unnested_or_patterns,
71    clippy::unused_self,
72    clippy::useless_transmute,
73    clippy::verbose_file_reads,
74    clippy::zero_sized_map_values,
75    unexpected_cfgs,
76    future_incompatible,
77    nonstandard_style,
78    rust_2018_idioms
79)]
80// not enforced right now:
81// clippy::doc_markdown -- false positives for term CloudFront
82
83// mem_forget: safe_cell
84// tabs_in_doc_comments: tab'ed CF log lines in examples
85#![allow(deprecated, clippy::tabs_in_doc_comments, clippy::mem_forget)]
86
87// @@@ NEW STRUCTURE @@@
88
89mod shared;
90
91pub mod borrowed;
92pub mod consts;
93pub mod owned;
94pub mod referential; // not sure about the module name yet
95pub mod types;
96
97pub use consts::*;
98pub use types::*;
99
100// useful helper function for minimizing validation needs
101pub use shared::validate_line;
102
103#[doc(inline)]
104pub use borrowed::{
105    UnvalidatedRawLogline, UnvalidatedSimpleLogline, ValidatedRawLogline, ValidatedSimpleLogline,
106};
107
108#[cfg(feature = "chrono")]
109#[doc(inline)]
110pub use borrowed::typed::{UnvalidatedChronoLogline, ValidatedChronoLogline};
111
112#[cfg(feature = "time")]
113#[doc(inline)]
114pub use borrowed::typed::{UnvalidatedTimeLogline, ValidatedTimeLogline};
115
116#[cfg(feature = "parquet")]
117#[doc(inline)]
118pub use borrowed::{UnvalidatedParquetLogline, ValidatedParquetLogline};
119
120#[doc(inline)]
121pub use referential::{
122    UnvalidatedRawLogline as OwningUnvalidatedRawLogline,
123    UnvalidatedSimpleLogline as OwningUnvalidatedSimpleLogline,
124    ValidatedRawLogline as OwningValidatedRawLogline,
125    ValidatedSimpleLogline as OwningValidatedSimpleLogline,
126};
127
128#[cfg(feature = "chrono")]
129#[doc(inline)]
130pub use referential::typed::{
131    UnvalidatedChronoLogline as OwningUnvalidatedChronoLogline,
132    ValidatedChronoLogline as OwningValidatedChronoLogline,
133};
134
135#[cfg(feature = "time")]
136#[doc(inline)]
137pub use referential::typed::{
138    UnvalidatedTimeLogline as OwningUnvalidatedTimeLogline,
139    ValidatedTimeLogline as OwningValidatedTimeLogline,
140};
141
142#[cfg(feature = "parquet")]
143#[doc(inline)]
144pub use referential::{
145    UnvalidatedParquetLogline as OwningUnvalidatedParquetLogline,
146    ValidatedParquetLogline as OwningValidatedParquetLogline,
147};
148
149#[cfg(feature = "parquet")]
150#[doc(inline)]
151pub use owned::{
152    UnvalidatedParquetLogline as OwnedUnvalidatedParquetLogline,
153    ValidatedParquetLogline as OwnedValidatedParquetLogline,
154};
155
156// === tests ===
157
158#[cfg(test)]
159mod tests;
160
161// !!! DEPRECATED !!!
162
163#[deprecated(
164    since = "0.7.0",
165    note = "use new modules/types instead (borrowed, owned, referential)"
166)]
167mod raw;
168#[deprecated(
169    since = "0.7.0",
170    note = "use new modules/types instead (borrowed, owned, referential)"
171)]
172mod simple;
173
174#[deprecated(
175    since = "0.7.0",
176    note = "use new modules/types instead (borrowed, owned, referential)"
177)]
178#[cfg(feature = "time")]
179mod typed;
180
181#[deprecated(
182    since = "0.7.0",
183    note = "use new modules/types instead (borrowed, owned, referential)"
184)]
185#[cfg(feature = "parquet")]
186mod parquet;
187
188#[deprecated(
189    since = "0.7.0",
190    note = "use new modules/types instead (borrowed, owned, referential)"
191)]
192pub mod deprecated {
193    pub use crate::raw::{CheckedRawLogLine, CheckedRawLogLineView, SmartRawLogLineView};
194
195    #[cfg(feature = "alloc")]
196    pub use crate::simple::SimpleLogLine;
197
198    #[cfg(feature = "time")]
199    pub use crate::typed::TypedLogLine;
200
201    #[cfg(feature = "parquet")]
202    pub use crate::parquet::ParquetLogLine;
203}
204
205pub use deprecated::*;