Crate flour

source ·
Expand description

A crate with data types for known BXCAD (BRCAD/BCCAD) formats

Obtaining and working with BXCAD formats

In order to parse a BXCAD file’s data, you must use the methods implemented in the BXCAD trait.

Example:

use flour::{BCCAD, BXCAD};

// Open a BCCAD file
let mut file = File::open("file.bccad")?;
let mut bccad = BCCAD::from_binary(&mut file)?;

// Delete all animations, and save as a new file
bccad.animations = vec![];
let mut out_file = File::create("file.out.bccad")?;
bccad.to_binary(&mut out_file)?;

Serializing and BXCADWrapper

While BXCAD doesn’t require serde::Serialize and serde::Deserialize, implementing those is the main idea behind the trait, since that way the BXCAD can be wrapped inside a bxcad::BXCADWrapper. The function of this struct is to give a common metadata API for all flour-compatible BXCADs.

You can create a BXCADWrapper like so:

use flour::bxcad::BXCADWrapper;

// this could instead be BXCADWrapper::from_bxcad_indexized, to allow indexization
let wrapper = BXCADWrapper::from_bxcad(bccad);
 

This BXCADWrapper can now be serialized/deserialized without any compatibility issues with other BXCAD types or with future/past versions of flour (post-1.0).

For details on “indexization”, see bxcad::qol::Indexizable.

Comments

flour supports the following types of comments:

  • Single-line: // comment
  • Multi-line: /* comment */

Features

  • modder_qol

Re-exports

  • pub use bxcad::bccad::BCCAD;
  • pub use bxcad::brcad::BRCAD;
  • pub use bxcad::BXCAD;

Modules

  • Contains a model for the generic BXCAD format, as well as known implementations of it
  • Error handling

Structs