fundamentum_edge_proto/
lib.rs

1//! Rust bindings to Fundamentum edge daemon's *gRPC* IDL files. A library that
2//! provides a Rust representation of the basic types, interfaces and other
3//! components required to define and interact with the *gRPC* interface defined
4//! by [`fundamentum-edge-proto`][repo-proto].
5//!
6//! Current direct users:
7//!
8//!  -  [`fundamentum-edge-daemon`][repo-daemon]: the actual edge daemon server
9//!     implementation.
10//!
11//! [repo-proto]: https://bitbucket.org/amotus/fundamentum-edge-proto
12//! [repo-daemon]: https://bitbucket.org/amotus/fundamentum-edge-daemon
13//!
14//! # Feature flags
15//!
16//!  -  `server`: build and expose *gRPC* server building blocks.
17//!
18//!  -  `client`: build and expose *gRPC* client building blocks.
19//!
20//!  -  `reflection`: build and expose *gRPC* reflection building blocks.
21//!
22//!     Use this alongside with the `server` flag if your *gRPC* server is to
23//!     provide a reflection service for runtime service discovery.
24//!
25//!     An encoded `FileDescriptorSet` will be made available as
26//!     [`FILE_DESCRIPTOR_SET`].
27//!
28//!     See
29//!     [tonic/examples/src/reflection/server.rs](https://github.com/hyperium/tonic/blob/master/examples/src/reflection/server.rs)
30//!     for a good example of adding such reflection service to your *gRPC*
31//!     server.
32//!
33//! Note that all of the above feature flags are active by default.
34
35#![deny(
36    clippy::all,
37    clippy::cargo,
38    clippy::nursery,
39    clippy::pedantic,
40    missing_docs
41)]
42#![expect(
43    clippy::multiple_crate_versions,
44    reason = "sri v9.2.0 uses base64 v0.21, which is older than base64 and cannot be used because tonic requires the newer v0.22 version."
45)]
46// Additional `clippy::restriction`.
47#![deny(
48    clippy::clone_on_ref_ptr,
49    clippy::create_dir,
50    clippy::dbg_macro,
51    clippy::exit,
52    clippy::filetype_is_file,
53    clippy::float_cmp_const,
54    clippy::indexing_slicing,
55    clippy::let_underscore_must_use,
56    clippy::lossy_float_literal,
57    clippy::map_err_ignore,
58    clippy::multiple_inherent_impl,
59    clippy::pattern_type_mismatch,
60    clippy::rc_buffer,
61    clippy::rc_mutex,
62    clippy::rest_pat_in_fully_bound_structs,
63    clippy::same_name_method,
64    clippy::self_named_module_files,
65    clippy::separated_literal_suffix,
66    clippy::str_to_string,
67    clippy::string_add,
68    clippy::string_slice,
69    clippy::string_to_string,
70    clippy::try_err,
71    clippy::unimplemented,
72    clippy::unnecessary_self_imports,
73    clippy::unneeded_field_pattern,
74    clippy::unreachable,
75    clippy::unwrap_used,
76    clippy::verbose_file_reads
77)]
78
79/// The rust bindings generated from the protobuf files under `./proto/`.
80///
81/// Mirrors original protobuf top level 'com' namespace.
82pub mod com {
83    /// Mirrors original protobuf namespace at 'com.fundamentum'.
84    ///
85    /// Exposes Fundamentum related protobuf symbols.
86    pub mod fundamentum {
87        /// Mirrors original protobuf namespace at 'com.fundamentum.edge'.
88        ///
89        /// Exposes Fundamentum Edge related protobuf symbols.
90        pub mod edge {
91            /// Mirrors original protobuf namespace at 'com.fundamentum.edge.v1'.
92            ///
93            /// Exposes Fundamentum Edge related protobuf symbols as of version 1
94            /// or the services.
95            pub mod v1 {
96                #![allow(
97                    clippy::clone_on_ref_ptr,
98                    clippy::default_trait_access,
99                    clippy::derive_partial_eq_without_eq,
100                    clippy::doc_markdown,
101                    clippy::future_not_send,
102                    clippy::missing_const_for_fn,
103                    clippy::missing_errors_doc,
104                    clippy::must_use_candidate,
105                    clippy::pattern_type_mismatch,
106                    clippy::similar_names,
107                    clippy::str_to_string,
108                    clippy::too_many_lines,
109                    clippy::wildcard_imports
110                )]
111                tonic::include_proto!("com.fundamentum.edge.v1");
112            }
113        }
114    }
115}
116
117/// Encoded `FileDescriptorSet` you will need if your *gRPC* server is to
118/// provide a reflection service for runtime service discovery.
119#[cfg(feature = "reflection")]
120pub const FILE_DESCRIPTOR_SET: &[u8] = tonic::include_file_descriptor_set!("descriptor");
121
122/// Client helpers.
123#[cfg(feature = "client")]
124pub mod helpers {
125    /// Helpers for the file transfer feature.
126    pub mod file_transfer {
127        mod accept_download;
128        mod accept_upload;
129        mod types;
130
131        #[cfg(test)]
132        mod test_utils;
133
134        pub use accept_download::{
135            AcceptDownloadError, AcceptDownloadOptions, AcceptDownloadOptionsBuilder,
136            AcceptDownloadResponse, DownloadProgress, accept_download_request,
137        };
138        pub use accept_upload::{
139            AcceptUploadError, AcceptUploadOptions, AcceptUploadResponse, UploadProgress,
140            accept_upload_request,
141        };
142        pub use types::IoError;
143    }
144}