From bc6ea0d030372192c56dacbba49819b879e1fd93 Mon Sep 17 00:00:00 2001 From: Will Hedgecock Date: Mon, 4 Nov 2024 12:27:59 -0600 Subject: [PATCH] Add no_std parsing instructions --- README.md | 10 ++++++++-- musicxml/src/lib.rs | 10 +++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 33a82f2..2a8a2cf 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ be robust and reliable, handling a wide variety of MusicXML files and formats wi - Supports both "partwise" and "timewise" data representations - Allows for transparent conversion between the partwise and timewise representations - Is provided as a Rust-format library so that it can be link-time optimized with your own code +- Is `no_std` compatible with default features turned off ## Getting Started @@ -24,7 +25,7 @@ To use this library in your Rust project, simply add the following line to your ```toml [dependencies] -musicxml = "1.0" +musicxml = "1.1" ``` You can then parse any regular MusicXML file or compressed MXL file into a structured data format using: @@ -49,6 +50,9 @@ match read_score_timewise("path/to/file.musicxml") { } ``` +If you are using this library in a `no_std` environment, you can parse MusicXML data directly by instead +calling the `read_score_data_partwise()` and `read_score_data_timewise()` functions. + Please refer to the [library documentation](https://docs.rs/musicxml/latest/) for full usage instructions. You may also want to consult the official [MusicXML Standard](https://www.w3.org/2021/06/musicxml40/) for additional details. @@ -60,6 +64,8 @@ This library is licensed under the [MIT license](http://opensource.org/licenses/ ## TODO -- [ ] Add documentation about "std" feature, including parsing to/from a data buffer instead of a file - [ ] Remove dependency on regex - [ ] Create WASM build + +- Finish ZIP writing +- Test all new stuff \ No newline at end of file diff --git a/musicxml/src/lib.rs b/musicxml/src/lib.rs index 61bc67a..b63a909 100644 --- a/musicxml/src/lib.rs +++ b/musicxml/src/lib.rs @@ -68,6 +68,10 @@ //! //! Note that this library is able to read both `.musicxml` files and compressed `.mxl` files. The file type being read is //! determined internally, and decoding will be handled automatically when calling either of the above functions. +//! +//! If you are using this library in a `no_std` environment, you can parse MusicXML data directly by calling the +//! [read_score_data_partwise] and [read_score_data_timewise] functions. These functions take a `Vec` containing +//! raw MusicXML data and return a [ScorePartwise] or [ScoreTimewise] object, respectively. //! //! # Writing MusicXML Files //! @@ -93,7 +97,8 @@ //! } //! ``` //! -//! Alternately, to write a [ScoreTimewise] object to a compressed MusicXML file using a partwise representation, you can do the following: +//! Alternately, to write a [ScoreTimewise] object to a compressed MusicXML file using a partwise representation, +//! you can do the following: //! //! ```ignore //! use musicxml::write_timewise_score; @@ -104,6 +109,9 @@ //! Err(e) => println!("Error writing compressed MusicXML file: {}", e), //! } //! ``` +//! +//! As with reading data, if you are using this library in a `no_std` environment, you can write MusicXML data +//! directly to a data buffer by calling the [write_partwise_score_data] and [write_timewise_score_data] functions. #[macro_use] extern crate alloc;