Crate sf3

Crate sf3 

Source
Expand description

An implementation of SF3 (Simple File Format Family) in Rust. See the spec at https://shirakumo.org/docs/sf3

This crate is an experimental work-in-progress still early in the design phase. Expect major breaking changes in the near future.

This crate provides structures for working with SF3 files. Several formats are currently implemented, including:

More are on the way! See the complete list the specification supports at https://shirakumo.org/docs/sf3/specification.html#formats

use sf3::file::Sf3File;
use sf3::Archive;

let archive_bytes: &[u8] = include_bytes!("../tests/archive/multi-text.ar.sf3"); // get this data from anywhere
let archive = Archive::parse_bytes(archive_bytes).unwrap();
assert_eq!(archive.payload.len(), 2);

§Crate Features

  • std (enabled by default) — Enables support for parsing files from Read types, and certain features in chrono, const-str, crc32fast, and half which require Rust’s std crate. All functions work well enough without std, including parsing from byte slices and generating new byte representations of SF3 files, so if you’re writing a no_std crate or targeting an environment where std isn’t available but alloc and core are, then you may disable this feature without much consequence.
  • serde — Enables serde support for chrono, half, and mediatype types.

Re-exports§

pub use archive::Archive;
pub use audio::Audio;
pub use log::Log;
pub use text::Text;

Modules§

archive
audio
error
file
log
text
util

Macros§

cstring
Converts a string literal into a CString<L>. A null byte is added before computing the string length. The program will not compile if the given value, plus a null byte, is larger than the given capacity.
cstring8
Converts a string literal into a CString8. A null byte is added before computing the string length. The program will not compile if the given value, plus a null byte, is larger than 255 bytes.
cstring16
Converts a string literal into a CString16. A null byte is added before computing the string length. The program will not compile if the given value, plus a null byte, is larger than 65,535 bytes.
cstring32
Converts a string literal into a CString32. A null byte is added before computing the string length. The program will not compile if the given value, plus a null byte, is larger than u32::MAX bytes.
cstring64
Converts a string literal into a CString64. A null byte is added before computing the string length. The program will not compile if the given value, plus a null byte, is larger than u64::MAX bytes.