fbxcel_dom/
lib.rs

1//! FBX DOM library.
2//!
3//! # Creating DOM
4//!
5//! ## Easy setup (recommended)
6//!
7//! If you don't care about low-level features (such as precise FBX version and
8//! parser warning handling), you can use easy setup using [`any`] module.
9//!
10//! ```no_run
11//! use fbxcel_dom::any::AnyDocument;
12//!
13//! let file = std::fs::File::open("sample.fbx").expect("Failed to open file");
14//! // You can also use raw `file`, but do buffering for better efficiency.
15//! let reader = std::io::BufReader::new(file);
16//!
17//! // Use `from_seekable_reader` for readers implementing `std::io::Seek`.
18//! // To use readers without `std::io::Seek` implementation, use `from_reader`
19//! // instead.
20//! match AnyDocument::from_seekable_reader(reader).expect("Failed to load document") {
21//!     AnyDocument::V7400(fbx_ver, doc) => {
22//!         // You got a document. You can do what you want.
23//!     }
24//!     // `AnyDocument` is nonexhaustive.
25//!     // You should handle unknown document versions case.
26//!     _ => panic!("Got FBX document of unsupported version"),
27//! }
28//! ```
29//!
30//! ## Manual setup
31//!
32//! You can create a parser or a tree by yourself, and use appropriate loader to
33//! load the document from it.
34//!
35//! For example:
36//!
37//! * From `tree: fbxcel::tree::v7400::Tree`, you can create the document by
38//!   `fbxcel_dom::v7400::Loader::load_from_tree(tree)`.
39//! * From `parser: fbxcel::pull_parser::v7400::Parser`, you can create the
40//!   document by `fbxcel_dom::v7400::Loader::load_from_parser(&mut parser)`.
41//!
42//! For detail, see documents of loaders.
43//!
44//! [`any`]: any/index.html
45#![forbid(unsafe_code)]
46#![warn(missing_docs)]
47#![warn(clippy::missing_docs_in_private_items)]
48
49pub use fbxcel;
50
51pub mod any;
52pub mod v7400;