[−][src]Struct obj::Obj
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]
path: impl AsRef<Path>,
config: LoadConfig
) -> Result<Obj, ObjError>
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]
R: BufRead,
F: FnMut(&Path, &str) -> Result<R>,
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,