Skip to main content

StorageWritable

Struct StorageWritable 

Source
pub struct StorageWritable { /* private fields */ }
Expand description

Writable CASC storage (read + write + save)

Inherits all read operations from Storage. Adds write overlay and persist-to-disk support.

Only local-backed storages can be writable (CDN is read-only).

extends=whiteout::storages::casc::Storage

Implementations§

Source§

impl StorageWritable

Source

pub fn create( opts: &CreateOptions, pool: Option<&HostWorkerPool>, ) -> Option<StorageWritable>

Create a new empty storage in memory.

No file is written to disk until save() is called.

@param opts Creation options (product name, version, root format). @param pool Optional WorkerPool for parallel I/O. @return A valid empty StorageWritable ready for writeFile() calls.

Source

pub fn reserve_file_id(&mut self, name: &str) -> Option<u32>

Reserve a file-data-ID for a named asset.

Allocates the next available file-data-ID and associates it with @p name. The interpretation of @p name depends on the root format:

  • WoW / WoWTvfs: @p name is a full CASC path (e.g. "Base\\creatures\\beast\\beast.m2"). - Diablo 3 / Diablo 4 / TVFS: @p name is "asset_name.ext", where the extension determines the SNO group. A CoreTOC entry is created automatically.

Returns @c std::nullopt if the name already exists in the root or in a previous reservation.

@code auto id = storage.reserveFileId(“my_beast.app”); if (id) storage.writeFile(*id, data); @endcode

Source

pub fn write_file( &mut self, path: &str, data: &[u8], opts: &WriteOptions, ) -> bool

Write a file by path.

Data is stored in an in-memory overlay until save() is called.

@param path CASC path for the new or updated file. @param data File contents. @param opts Write options (locale, content flags, compression). @return True on success.

Source

pub fn write_file_file_id_data_opts_hint( &mut self, file_id: i32, data: &[u8], opts: &WriteOptions, hint: FileIdHint, ) -> bool

@overload Write a file by FileDataId.

Source

pub fn delete_file(&mut self, path: &str) -> bool

Mark a file for deletion (effective on next save).

Source

pub fn delete_file_file_id_hint( &mut self, file_id: i32, hint: FileIdHint, ) -> bool

@overload

Source

pub fn save(&mut self) -> bool

Persist all pending changes to disk (writes to the original location).

Source

pub fn save_path(&mut self, path: &str) -> bool

@overload Persist to a specific output path.

Trait Implementations§

Source§

impl Debug for StorageWritable

Source§

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

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

impl Drop for StorageWritable

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for StorageWritable

Auto Trait Implementations§

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.