1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Warnings: problems that do not stop an operation but change its result, such as a CRS that
//! terrio reads but cannot represent. They are kept for the thread that raised them until taken
//! with [`take`], so that callers (the command line, the Python bindings) can report them.
//! Warnings are raised where datasets are opened, on the caller's thread: those raised on other
//! threads (a worker of a parallel operation) are kept for those threads and not reported.
use RefCell;
/// The most warnings kept: older ones are dropped.
const MAX: usize = 100;
thread_local!
/// Records a warning on this thread (once: a repeated one is not recorded again).
pub
/// Takes the warnings recorded on this thread since the last call, oldest first.
///
/// ```
/// let _ = terrio::warnings::take(); // Nothing to report yet.
/// assert!(terrio::warnings::take().is_empty());
/// ```