pub struct Storage { /* private fields */ }Expand description
Implementations§
Source§impl Storage
impl Storage
Sourcepub fn open_scoped(
game_dir: &str,
mod_id: &str,
scope: StorageScope<'_>,
) -> Storage
pub fn open_scoped( game_dir: &str, mod_id: &str, scope: StorageScope<'_>, ) -> Storage
Open a store with an explicit StorageScope.
Sourcepub fn open_player(game_dir: &str, mod_id: &str, player_uuid: &str) -> Storage
pub fn open_player(game_dir: &str, mod_id: &str, player_uuid: &str) -> Storage
Open a per-player store (keyed by player UUID).
Sourcepub fn open_world(game_dir: &str, mod_id: &str, dimension: &str) -> Storage
pub fn open_world(game_dir: &str, mod_id: &str, dimension: &str) -> Storage
Open a per-dimension store.
Sourcepub fn open_entity(game_dir: &str, mod_id: &str, entity_uuid: &str) -> Storage
pub fn open_entity(game_dir: &str, mod_id: &str, entity_uuid: &str) -> Storage
Open a per-entity store (keyed by entity UUID).
Sourcepub fn open_chunk(
game_dir: &str,
mod_id: &str,
dimension: &str,
cx: i32,
cz: i32,
) -> Storage
pub fn open_chunk( game_dir: &str, mod_id: &str, dimension: &str, cx: i32, cz: i32, ) -> Storage
Open a per-chunk store.
pub fn get(&self, key: &str) -> Option<&Value>
pub fn get_str(&self, key: &str) -> Option<&str>
pub fn get_int(&self, key: &str) -> Option<i64>
pub fn get_float(&self, key: &str) -> Option<f64>
pub fn get_bool(&self, key: &str) -> Option<bool>
pub fn get_bytes(&self, key: &str) -> Option<&[u8]>
pub fn contains(&self, key: &str) -> bool
Sourcepub fn set(&mut self, key: impl Into<String>, value: impl Into<Value>)
pub fn set(&mut self, key: impl Into<String>, value: impl Into<Value>)
Insert or replace a value.
Accepts any type that implements Into<Value> — i64, f64, bool,
&str, String, Vec<u8>, etc.
pub fn remove(&mut self, key: &str) -> Option<Value>
pub fn clear(&mut self)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn is_dirty(&self) -> bool
pub fn iter(&self) -> impl Iterator<Item = (&str, &Value)>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Storage
impl RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl UnsafeUnpin for Storage
impl UnwindSafe for Storage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more