1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! # sb3-decoder
//! A Rust crate that decodes Scratch 3.0 project files (.sb3) into rust structs and enums.
//!
//! # Example
//! ```no_run
//! use sb3_decoder::prelude::*;
//!
//! let mut decoder = {
//! let decoder = Decoder::from_file("project.sb3"); // Read from a file
//! # /* rust wouldn't be able to find project.sb3, so this part is commented out
//! let decoder = Decoder::from_bytes(include_bytes!("project.sb3")); // Or load from memory
//! # */
//! decoder.expect("project should be valid")
//! };
//!
//! // Decode the project
//! let project = decoder.decode().expect("project should be valid");
//!
//! // Now let's print every hat and action block we find inside the Cat sprite
//! let cat = project
//! .sprites
//! .iter()
//! .find(|sprite| sprite.name == "Cat")
//! .expect("there should be a Cat sprite");
//! for script in &cat.scripts {
//! println!("{:?}", script.hat);
//! for action in &script.actions {
//! println!("{action:?}");
//! }
//! }
//! ```
//!
//! # Feature flags
//! The features `costumes` and `sounds` are enabled by default.
//!
//! - `costumes` - costume decoding support, using image and resvg.
//! - `sounds` - sound decoding support, using hound and nanomp3.
pub
pub
pub use Error;