[][src]Struct obj::Obj

pub struct Obj {
    pub data: ObjData,
    pub path: PathBuf,
}

A struct used to store Obj data as well as its source directory used to load the referenced .mtl files.

Fields

data: ObjData

The data associated with this Obj file.

path: PathBuf

The path of the parent directory from which this file was read.

It is not always set since the file may have been read from a String.

Implementations

impl Obj[src]

pub fn save(&self, path: impl AsRef<Path>) -> Result<(), ObjError>[src]

Save the current Obj at the given file path as well as any associated .mtl files.

If a file already exists, it will be overwritten.

impl Obj[src]

pub fn load(path: impl AsRef<Path>) -> Result<Obj, ObjError>[src]

Load an Obj file from the given path with the default load configuration.

pub fn load_with_config(
    path: impl AsRef<Path>,
    config: LoadConfig
) -> Result<Obj, ObjError>
[src]

Load an Obj file from the given path using a custom load configuration.

pub fn load_mtls(&mut self) -> Result<(), MtlLibsLoadError>[src]

Loads the .mtl files referenced in the .obj file.

If it encounters an error for an .mtl, it appends its error to the returning Vec, and tries the rest.

pub fn load_mtls_fn<R, F>(&mut self, resolve: F) -> Result<(), MtlLibsLoadError> where
    R: BufRead,
    F: FnMut(&Path, &str) -> Result<R>, 
[src]

Loads the .mtl files referenced in the .obj file with user provided loading logic.

See also load_mtls.

The provided function must take two arguments:

  • &Path - The parent directory of the .obj file
  • &str - The name of the mtllib as listed in the file.

This function allows loading .mtl files in directories different from the default .obj directory.

It must return:

  • Anything that implements io::BufRead that yields the contents of the intended .mtl file.

Trait Implementations

impl Clone for Obj[src]

impl Debug for Obj[src]

Auto Trait Implementations

impl RefUnwindSafe for Obj

impl Send for Obj

impl Sync for Obj

impl Unpin for Obj

impl UnwindSafe for Obj

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.