Trait oc2_hlapi::device::FileImportExportInterface

source ·
pub trait FileImportExportInterface: RpcDevice {
    // Required methods
    fn request_import_file(&self) -> Result<bool>
       where bool: DeserializeOwned + 'static;
    fn begin_import_file(&self) -> Result<Option<ImportFileInfo>>
       where Option<ImportFileInfo>: DeserializeOwned + 'static;
    fn read_import_file(&self) -> Result<Option<Vec<u8>>>
       where Option<Vec<u8>>: DeserializeOwned + 'static;
    fn begin_export_file(&self, name: &str) -> Result<()>
       where (): DeserializeOwned + 'static;
    fn write_export_file(&self, data: &[u8]) -> Result<()>
       where (): DeserializeOwned + 'static;
    fn finish_export_file(&self) -> Result<()>
       where (): DeserializeOwned + 'static;
    fn reset(&self) -> Result<()>
       where (): DeserializeOwned + 'static;
}
Expand description

An interface for transferring files between a user’s real computer and the HLAPI

Required Methods§

source

fn request_import_file(&self) -> Result<bool>
where bool: DeserializeOwned + 'static,

Requests the start of a file import, returning true if a file can be imported.

source

fn begin_import_file(&self) -> Result<Option<ImportFileInfo>>

Prompts the player to select a file to import, returning the information for the file requested. This method should be called in a loop, as it may return None before eventually returning the file information.

source

fn read_import_file(&self) -> Result<Option<Vec<u8>>>
where Option<Vec<u8>>: DeserializeOwned + 'static,

Reads a portion of the file currently being imported. Returns a slice of bytes containing the portion of the file that has been read. Returns None when the file has been fully imported. If the byte slice is empty, it means that the device is not ready to import the file.

source

fn begin_export_file(&self, name: &str) -> Result<()>
where (): DeserializeOwned + 'static,

Prompts the user to select a path where a file with the given name should be exported.

source

fn write_export_file(&self, data: &[u8]) -> Result<()>
where (): DeserializeOwned + 'static,

Writes some data to the current file being exported.

source

fn finish_export_file(&self) -> Result<()>
where (): DeserializeOwned + 'static,

Finishes the currently running file export operation.

source

fn reset(&self) -> Result<()>
where (): DeserializeOwned + 'static,

Resets the device’s state, preparing it for another file import or export operation.

Object Safety§

This trait is not object safe.

Implementors§