Skip to content

Commit

Permalink
feat(zink): move storage trait to module storage
Browse files Browse the repository at this point in the history
  • Loading branch information
clearloop committed Feb 2, 2024
1 parent d74eb34 commit c43bfda
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
3 changes: 3 additions & 0 deletions examples/mapping.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! Mapping example.
#![cfg_attr(target_arch = "wasm32", no_std)]
#![cfg_attr(target_arch = "wasm32", no_main)]
3 changes: 2 additions & 1 deletion zink/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
#![no_std]

pub mod ffi;
mod storage;
mod traits;

pub use traits::{Event, Storage};
pub use self::{storage::Storage, traits::Event};
pub use zink_codegen::{constructor, external, storage, Event};

// Panic hook implementation
Expand Down
Empty file added zink/src/storage/mapping.rs
Empty file.
12 changes: 12 additions & 0 deletions zink/src/storage/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//! Zink storage implementation.
/// Storage trait. Currently not for public use
pub trait Storage<T> {
const STORAGE_KEY: i32;

/// Get value from storage.
fn get() -> T;

/// Set value to storage.
fn set(value: T);
}
11 changes: 0 additions & 11 deletions zink/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,3 @@ pub trait Event {
}
}
}

/// Storage trait. Currently not for public use
pub trait Storage<T> {
const STORAGE_KEY: i32;

/// Get value from storage.
fn get() -> T;

/// Set value to storage.
fn set(value: T);
}

0 comments on commit c43bfda

Please sign in to comment.