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> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.