Skip to main content

SdkStorage

Struct SdkStorage 

Source
pub struct SdkStorage<S> { /* private fields */ }
Expand description

A Storage of one file per key in the game’s data folder.

Implementations§

Source§

impl<S: Sdk> SdkStorage<S>

Source

pub fn new(sdk: S) -> Self

The game’s storage on sdk’s files.

Source

pub fn in_folder(sdk: S, folder: &str) -> Self

The storage in folder (a name without /) of the game’s data folder, which a write makes.

Trait Implementations§

Source§

impl<S: Debug> Debug for SdkStorage<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: Sdk> Storage for SdkStorage<S>

Source§

fn read(&self, key: &str) -> Result<Option<String>, StorageError>

The value stored at key, or None if nothing has been written there (or it was deleted).
Source§

fn write(&mut self, key: &str, value: &str) -> Result<(), StorageError>

Stores value at key, replacing whatever was there.
Source§

fn delete(&mut self, key: &str) -> Result<(), StorageError>

Removes key. Not an error if it didn’t exist.
Source§

fn list(&self) -> Result<Vec<String>, StorageError>

Every key currently stored, in no particular order.

Auto Trait Implementations§

§

impl<S> Freeze for SdkStorage<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for SdkStorage<S>
where S: RefUnwindSafe,

§

impl<S> Send for SdkStorage<S>
where S: Send,

§

impl<S> Sync for SdkStorage<S>
where S: Sync,

§

impl<S> Unpin for SdkStorage<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for SdkStorage<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for SdkStorage<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.