diff --git a/core/src/api.rs b/core/src/api.rs index 534778b529c..cad12fd5563 100644 --- a/core/src/api.rs +++ b/core/src/api.rs @@ -31,9 +31,8 @@ use crate::types::Location; feature = "filesystem-client" ))] use crate::types::Message; -use crate::types::PathBuf; #[cfg(feature = "filesystem-client")] -use crate::types::{DirEntry, UserAttribute}; +use crate::types::{DirEntry, NotBefore, PathBuf, UserAttribute}; #[cfg(any(feature = "attestation-client", feature = "crypto-client"))] use crate::types::{KeyId, Mechanism}; #[cfg(feature = "crypto-client")] @@ -51,32 +50,6 @@ mod macros; // // At minimum, we don't want to list the indices (may need proc-macro) -#[derive(Clone, Eq, PartialEq, Debug, serde::Serialize, serde::Deserialize)] -pub enum NotBefore { - /// Start iteration at the beginning of the directory - None, - /// Start iteration at an exact match with the provided filename - Filename(PathBuf), - /// Start iteration at the first path that is "after" the provided filename - FilenamePart(PathBuf), -} - -impl NotBefore { - pub fn with_filename(value: Option) -> Self { - match value { - None => Self::None, - Some(p) => Self::Filename(p), - } - } - - pub fn with_filename_part(value: Option) -> Self { - match value { - None => Self::None, - Some(p) => Self::FilenamePart(p), - } - } -} - generate_enums! { //////////// diff --git a/core/src/client/filesystem.rs b/core/src/client/filesystem.rs index 1f355885255..f527faaac22 100644 --- a/core/src/client/filesystem.rs +++ b/core/src/client/filesystem.rs @@ -1,7 +1,7 @@ use super::{ClientResult, PollClient}; use crate::{ - api::{reply, request, NotBefore}, - types::{Location, Message, PathBuf, UserAttribute}, + api::{reply, request}, + types::{Location, Message, NotBefore, PathBuf, UserAttribute}, }; /// Read/Write/Delete files, iterate over directories. diff --git a/core/src/types.rs b/core/src/types.rs index 52300fb6dfe..409eb906522 100644 --- a/core/src/types.rs +++ b/core/src/types.rs @@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize}; pub use heapless_bytes::Bytes; pub use littlefs2_core::{DirEntry, Metadata, PathBuf}; +#[cfg(feature = "crypto-client")] use crate::api::{reply, request}; use crate::config::{ MAX_KEY_MATERIAL_LENGTH, MAX_MEDIUM_DATA_LENGTH, MAX_MESSAGE_LENGTH, MAX_SHORT_DATA_LENGTH, @@ -386,6 +387,32 @@ impl Default for StorageAttributes { } } +#[derive(Clone, Eq, PartialEq, Debug, serde::Serialize, serde::Deserialize)] +pub enum NotBefore { + /// Start iteration at the beginning of the directory + None, + /// Start iteration at an exact match with the provided filename + Filename(PathBuf), + /// Start iteration at the first path that is "after" the provided filename + FilenamePart(PathBuf), +} + +impl NotBefore { + pub fn with_filename(value: Option) -> Self { + match value { + None => Self::None, + Some(p) => Self::Filename(p), + } + } + + pub fn with_filename_part(value: Option) -> Self { + match value { + None => Self::None, + Some(p) => Self::FilenamePart(p), + } + } +} + /// Available client traits. /// /// This enum does not provide access to the trait features. It is only intended for backends to diff --git a/src/api.rs b/src/api.rs new file mode 100644 index 00000000000..a543edaf632 --- /dev/null +++ b/src/api.rs @@ -0,0 +1,2 @@ +pub use trussed_core::api::*; +pub use trussed_core::types::NotBefore; diff --git a/src/lib.rs b/src/lib.rs index 2eaf097814e..0303caec996 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,6 +24,7 @@ generate_macros!(); pub use interchange::Interchange; +pub mod api; pub mod backend; pub mod client; pub mod config; @@ -51,7 +52,7 @@ pub use error::Error; pub use platform::Platform; pub use service::Service; -pub use trussed_core::{api, block, error, interrupt, syscall, try_syscall}; +pub use trussed_core::{block, error, interrupt, syscall, try_syscall}; pub use cbor_smol::cbor_deserialize; pub use heapless_bytes::Bytes;