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§
sourcefn request_import_file(&self) -> Result<bool>where
bool: DeserializeOwned + 'static,
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.
sourcefn begin_import_file(&self) -> Result<Option<ImportFileInfo>>
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.
sourcefn read_import_file(&self) -> Result<Option<Vec<u8>>>
fn read_import_file(&self) -> Result<Option<Vec<u8>>>
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.
sourcefn begin_export_file(&self, name: &str) -> Result<()>where
(): DeserializeOwned + 'static,
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.
sourcefn write_export_file(&self, data: &[u8]) -> Result<()>where
(): DeserializeOwned + 'static,
fn write_export_file(&self, data: &[u8]) -> Result<()>where
(): DeserializeOwned + 'static,
Writes some data to the current file being exported.
sourcefn finish_export_file(&self) -> Result<()>where
(): DeserializeOwned + 'static,
fn finish_export_file(&self) -> Result<()>where
(): DeserializeOwned + 'static,
Finishes the currently running file export operation.