pub struct PhysFs {}Expand description
This struct doesn’t store any state, his sole purpose is to ensure that all PhysicsFs calls are done after calling his init function. Only ine instance of it can exist at any given time. This is because PhysicsFs has a global state so this struct makes sure rust borrowing rules are enforced
Implementations§
Source§impl PhysFs
impl PhysFs
Sourcepub fn get() -> Option<Self>
pub fn get() -> Option<Self>
When calling this method for the first time an instance of Self will be returned, if called again it will return None ensuring that no more than one instance exists
Sourcepub fn mount(
&mut self,
dir: impl AsRef<str>,
mount_point: impl AsRef<str>,
append: bool,
) -> Result<(), PhysFsError>
pub fn mount( &mut self, dir: impl AsRef<str>, mount_point: impl AsRef<str>, append: bool, ) -> Result<(), PhysFsError>
Mounts dir to mount_point.
dir can either be a path to an archive of a supported format or to a directory
Sourcepub fn open_read(
&self,
path: impl AsRef<str>,
) -> Result<PhysFsHandle, PhysFsError>
pub fn open_read( &self, path: impl AsRef<str>, ) -> Result<PhysFsHandle, PhysFsError>
Open file inside virtual fs for reading
Sourcepub fn open_write(
&self,
path: impl AsRef<str>,
) -> Result<PhysFsHandle, PhysFsError>
pub fn open_write( &self, path: impl AsRef<str>, ) -> Result<PhysFsHandle, PhysFsError>
Open file inside virtual fs for writing. If the file already exists it will be truncated
Sourcepub fn open_append(
&self,
path: impl AsRef<str>,
) -> Result<PhysFsHandle, PhysFsError>
pub fn open_append( &self, path: impl AsRef<str>, ) -> Result<PhysFsHandle, PhysFsError>
Open file inside virtual fs for writing. If the file already exists new writes will be appended to the existing contents
Sourcepub fn enumerate_files(&self, path: impl AsRef<str>) -> Option<Vec<String>>
pub fn enumerate_files(&self, path: impl AsRef<str>) -> Option<Vec<String>>
Enumerates the files in a given searchpath directory. None if erros occur