pub struct XFile {
pub templates: HashMap<String, Template>,
pub data_objects: Vec<DataValue>,
}
Fields§
§templates: HashMap<String, Template>
§data_objects: Vec<DataValue>
Implementations§
Source§impl XFile
impl XFile
Sourcepub fn read(data: &[u8]) -> Result<Self, XFileError>
pub fn read(data: &[u8]) -> Result<Self, XFileError>
Examples found in repository?
More examples
examples/2obj.rs (line 14)
8fn main() -> Result<(), XFileError> {
9 let input_path = std::env::args().nth(1).expect("Usage: <program> input.x");
10 let output_path = input_path.replace(".x", ".obj");
11 let mtl_path = input_path.replace(".x", ".mtl");
12
13 let contents = std::fs::read(&input_path).expect("Failed to read .x file");
14 let xfile = XFile::read(&contents)?;
15
16 write_obj(&xfile, &output_path, &mtl_path).expect("Failed to write .obj");
17 println!("Converted to: {}", output_path);
18
19 Ok(())
20}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for XFile
impl RefUnwindSafe for XFile
impl Send for XFile
impl Sync for XFile
impl Unpin for XFile
impl UnwindSafe for XFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more