PhysFs

Struct PhysFs 

Source
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

Source

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

Source

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

Source

pub fn open_read( &self, path: impl AsRef<str>, ) -> Result<PhysFsHandle, PhysFsError>

Open file inside virtual fs for reading

Source

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

Source

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

Source

pub fn enumerate_files(&self, path: impl AsRef<str>) -> Option<Vec<String>>

Enumerates the files in a given searchpath directory. None if erros occur

Source

pub fn is_directory(&self, path: impl AsRef<str>) -> bool

Trait Implementations§

Source§

impl Drop for PhysFs

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for PhysFs

§

impl RefUnwindSafe for PhysFs

§

impl Send for PhysFs

§

impl Sync for PhysFs

§

impl Unpin for PhysFs

§

impl UnwindSafe for PhysFs

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.