Skip to main content

dlms_cosem_kit/
lib.rs

1#![no_std]
2#![forbid(unsafe_code)]
3#![deny(missing_docs)]
4// Everything in this crate faces the network before any key has been checked, so the
5// ways a decoder can abort the process are denied outright rather than reviewed.
6#![deny(
7    clippy::panic,
8    clippy::unwrap_used,
9    clippy::expect_used,
10    clippy::todo,
11    clippy::unimplemented,
12    clippy::mem_forget,
13    clippy::exit
14)]
15#![warn(clippy::pedantic)]
16// A test is allowed to abort: that is what a failing assertion is.
17#![cfg_attr(test, allow(clippy::unwrap_used, clippy::panic, clippy::expect_used))]
18// Bounds-checked indexing and checked arithmetic are the deeper hygiene: every site in
19// this crate is guarded by a preceding length check, but the lints cannot see that, so
20// they live behind `--cfg dlms_audit`, which CI turns on for an audit pass. A cfg rather
21// than a feature, so `--all-features` and docs.rs never trip over them.
22#![cfg_attr(dlms_audit, warn(clippy::indexing_slicing, clippy::arithmetic_side_effects))]
23#![allow(
24    clippy::missing_errors_doc,
25    clippy::module_name_repetitions,
26    clippy::must_use_candidate,
27    clippy::similar_names,
28    clippy::wildcard_imports,
29    clippy::match_same_arms,
30    clippy::cast_possible_truncation,
31    clippy::cast_sign_loss,
32    clippy::cast_possible_wrap,
33    clippy::cast_lossless,
34    clippy::doc_markdown,
35    clippy::redundant_closure_for_method_calls,
36    clippy::needless_lifetimes,
37    clippy::many_single_char_names,
38    clippy::struct_field_names
39)]
40#![doc = include_str!("../README.md")]
41
42#[cfg(feature = "alloc")]
43extern crate alloc;
44
45#[cfg(feature = "std")]
46extern crate std;
47
48/// Recipes for meter clients and servers using the default features.
49#[cfg(all(
50    feature = "std",
51    feature = "client",
52    feature = "server",
53    feature = "hdlc",
54    feature = "wrapper",
55    feature = "p1",
56    feature = "suite0",
57    feature = "obis-names",
58))]
59#[doc = include_str!("../site/includes/cookbook.md")]
60pub mod cookbook {}
61
62// `std` brings the operating system's randomness for `security::OsRandom`, which lives
63// beside the provider it feeds; a `std` build without `suite0` links it unused.
64#[cfg(all(feature = "std", not(feature = "suite0")))]
65use getrandom as _;
66
67pub mod codec;
68
69pub mod acse;
70pub mod ber;
71pub mod cosem;
72pub mod security;
73pub mod transport;
74pub mod xdlms;
75
76#[cfg(feature = "client")]
77pub mod client;
78#[cfg(feature = "server")]
79pub mod server;
80
81pub mod axdr;
82pub mod obis;
83
84pub use codec::{Error, ErrorKind, Reader, Result, SliceWriter, Writer};
85pub use obis::Obis;
86pub use xdlms::Apdu;