From 3155243ae9493086c4cf6dd0baa8238be1252d94 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Fri, 2 Feb 2024 17:28:58 +0100 Subject: [PATCH] starting stores --- mission_rust/src/fsrc/store.rs | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 mission_rust/src/fsrc/store.rs diff --git a/mission_rust/src/fsrc/store.rs b/mission_rust/src/fsrc/store.rs new file mode 100644 index 0000000..2355c72 --- /dev/null +++ b/mission_rust/src/fsrc/store.rs @@ -0,0 +1,38 @@ +use crate::check_global_threading_available; + +struct Store{ + mutex: crate::fsrc::mutex::RawMutex +} + +trait StoreBackend { + +} + +struct StoreAccessor { + mutex: crate::fsrc::mutex::RawMutex +} + +impl Store { + pub fn get_accessor(&self) -> StoreAccessor { + check_global_threading_available!(); + StoreAccessor{mutex: self.mutex.clone()} + } +} + +struct StoreSlot{ + data: *mut [u8] +} + +impl StoreSlot { + pub fn get_data(&self) -> &[u8] { + check_global_threading_available!(); + unsafe{&(*self.data)} + } + + pub fn get_all_data(&self) -> &[u8] { + check_global_threading_available!(); + unsafe{&(*self.data)} + } + + +} \ No newline at end of file