rusp_lib/lib.rs
1//! A toolkit, written in **[Rust][]**, providing support to work with **[USP][]** Records and Messages which are encoded in Protobuf bytestreams.
2//!
3//! # What is it?
4//!
5//! While a Protobuf schema exists which allows generating bindings for several commonly used
6//! programming languages, those are either uncomfortable to use and/or highly unsafe. By leveraging
7//! the strong Rust type system and the strict compiler, Rust is capable of detecting many incorrect
8//! or incomplete uses of the Protobuf encoding at compile time which allows for confident use of the
9//! **[USP][]** protocol. This crate provides an abstraction over the automatically generated
10//! Protobuf De-/Serialisers as well as a tool to work with USP Records and Messages on the
11//! command line.
12//!
13//! # What is included?
14//!
15//! The toolkit includes:
16//! * Generated low-level Rust Protobuf bindings
17//! * [USP Record][`rusp::usp_record`]
18//! * [USP Messages][`rusp::usp`]
19//! * A library providing:
20//! * Higher level access to [deserialisation][`rusp::usp_decoder`] functionality
21//! * Convenience functions to [work with the native Msg types][`rusp::usp_decoder`]
22//! * Pretty printing of **USP** Records and Messages
23//! * Serde de-/serialisation of **USP** Records and Messages
24//! * Unittests and documentation (including doctests/examples)
25//! * A **rusp** binary granting access to library functionality via command line. Included functionality at the moment are:
26//! * Decoding of **USP** Msg Protobuf byte streams from standard input
27//! * Decoding of **USP** Msg Protobuf byte streams from file(s)
28//! * Decoding of **USP** Record Protobuf byte streams from standard input
29//! * Decoding of **USP** Record Protobuf byte streams from file(s)
30//! * Extraction of **USP** Msg Protobuf byte streams from the payload of a **USP** Record Protobuf byte stream
31//! * Generation of **USP** Msg Protobuf byte streams and C char arrays for selected messages and Error
32//!
33//! [Rust]: https://www.rust-lang.org/
34//! [USP]: https://usp.technology/
35//! [BBF]: https://www.broadband-forum.org/
36//! [Axiros]: https://www.axiros.com/
37//! [`rusp::usp`]: crate::usp
38//! [`rusp::usp_record`]: crate::usp_record
39//! [`rusp::usp_decoder`]: crate::usp_decoder
40
41/// Automatically generated bindings for USP Msgs from the [`USP Messages Protobuf schema`]
42///
43/// [`USP Messages Protobuf schema`]: <https://usp.technology/specification/usp-msg-1-3.proto>
44pub mod usp;
45
46/// Builder style functions to generate USP Messages
47pub mod usp_builder;
48
49/// Helper functions to decode a Protobuf encoded byte stream into Rust types
50pub mod usp_decoder;
51
52/// Helper functions to encode native Rust types into Protobuf encoded byte streams
53pub mod usp_encoder;
54
55/// Automatically generated bindings for USP Records from the [`USP Records Protobuf schema`]
56///
57/// [`USP Records Protobuf schema`]: <https://usp.technology/specification/usp-record-1-3.proto>
58pub mod usp_record;
59
60/// Helper functions for checking and conversion of USP error codes and messages
61pub mod usp_errors;
62
63mod usp_json;