Add Storage and UpgradeStorage to Env
This commit is contained in:
14
src/env/mod.rs
vendored
14
src/env/mod.rs
vendored
@@ -1,6 +1,8 @@
|
||||
use crate::api::upgrade_storage::UpgradeStorage;
|
||||
use crate::ctap::hid::ChannelID;
|
||||
use crate::ctap::status_code::Ctap2StatusCode;
|
||||
use crypto::rng256::Rng256;
|
||||
use persistent_store::{Storage, StorageResult};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub mod test;
|
||||
@@ -17,7 +19,19 @@ pub trait UserPresence {
|
||||
pub trait Env {
|
||||
type Rng: Rng256;
|
||||
type UserPresence: UserPresence;
|
||||
type Storage: Storage;
|
||||
type UpgradeStorage: UpgradeStorage;
|
||||
|
||||
fn rng(&mut self) -> &mut Self::Rng;
|
||||
fn user_presence(&mut self) -> &mut Self::UserPresence;
|
||||
|
||||
/// Returns the unique storage instance.
|
||||
///
|
||||
/// This function is called at most once. Implementation may panic if called more than once.
|
||||
fn storage(&mut self) -> StorageResult<Self::Storage>;
|
||||
|
||||
/// Returns the unique upgrade storage instance.
|
||||
///
|
||||
/// This function is called at most once. Implementation may panic if called more than once.
|
||||
fn upgrade_storage(&mut self) -> StorageResult<Self::UpgradeStorage>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user