Skip to content

Commit

Permalink
core: Flatten public module structure
Browse files Browse the repository at this point in the history
This patch makes some modules of the core crate private and re-exports
their contents from the crate root.  This has two benefits:  It makes
it easier to read the crate documentation because the most important
types are directly visible from the root.  And it makes the imports for
the most important types less verbose.

See also: #155
  • Loading branch information
robin-nitrokey committed Dec 19, 2024
1 parent f97475e commit 334b3d1
Show file tree
Hide file tree
Showing 10 changed files with 702 additions and 712 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,5 @@ jobs:
- name: Check documentation
run: |
export RUSTDOCFLAGS="-D warnings"
cargo doc --no-deps --features serde-extensions,virt
cargo doc --no-deps --package trussed-core --all-features
cargo doc --no-deps --workspace --all-features
if: matrix.target == 'x86_64-unknown-linux-gnu'
29 changes: 7 additions & 22 deletions core/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,19 @@ use crate::{
};

#[cfg(feature = "attestation-client")]
mod attestation;
pub mod attestation;
#[cfg(feature = "certificate-client")]
mod certificate;
pub mod certificate;
#[cfg(feature = "counter-client")]
mod counter;
pub mod counter;
#[cfg(feature = "crypto-client")]
mod crypto;
pub mod crypto;
#[cfg(feature = "filesystem-client")]
mod filesystem;
pub mod filesystem;
#[cfg(feature = "management-client")]
mod management;
pub mod management;
#[cfg(feature = "ui-client")]
mod ui;

#[cfg(feature = "attestation-client")]
pub use attestation::AttestationClient;
#[cfg(feature = "certificate-client")]
pub use certificate::CertificateClient;
#[cfg(feature = "counter-client")]
pub use counter::CounterClient;
#[cfg(feature = "crypto-client")]
pub use crypto::*;
#[cfg(feature = "filesystem-client")]
pub use filesystem::FilesystemClient;
#[cfg(feature = "management-client")]
pub use management::ManagementClient;
#[cfg(feature = "ui-client")]
pub use ui::UiClient;
pub mod ui;

// to be fair, this is a programmer error,
// and could also just panic
Expand Down
Loading

0 comments on commit 334b3d1

Please sign in to comment.