Skip to content

Commit

Permalink
Make library no_std compatible (behind feature)
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgecrw committed Aug 1, 2024
1 parent 068602c commit d76831a
Show file tree
Hide file tree
Showing 608 changed files with 728 additions and 68 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resolver = "2"

[workspace.package]
edition = "2021"
version = "1.0.6"
version = "1.0.7"
authors = ["Will Hedgecock <will.hedgecock@gmail.com>"]
license = "MIT"
documentation = "https://docs.rs/musicxml/latest/"
Expand All @@ -16,11 +16,11 @@ categories = ["api-bindings", "encoding", "parsing"]
publish = true

[workspace.dependencies]
musicxml_internal = { path = "musicxml_internal", version = "1.0.6" }
musicxml_macros = { path = "musicxml_macros", version = "1.0.6" }
musicxml_internal = { path = "musicxml_internal", version = "1.0.7" }
musicxml_macros = { path = "musicxml_macros", version = "1.0.7" }

[profile.release]
codegen-units = 4096
codegen-units = 1
debug = false
debug-assertions = false
incremental = false
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ details.
## License

This library is licensed under the [MIT license](http://opensource.org/licenses/MIT).


## TODO

Add documentation about "std" feature, add options to parse MusicXML files directly from string (both compressed and uncompressed), same for writing to string
8 changes: 6 additions & 2 deletions musicxml/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ publish.workspace = true
rustdoc-args = ["--extend-css", "assets/docs.css"]

[dependencies]
regex = { version = "1.10", default-features = false, features = ["std", "perf"] }
zip = { version = "2.1", default-features = false, features = ["deflate"] }
regex = { version = "1.10", default-features = false, features = ["perf"] }
zip = { version = "2.1", default-features = false, features = ["deflate"], optional = true }
musicxml_internal.workspace = true
musicxml_macros.workspace = true

[features]
default = ["std"]
std = ["zip", "regex/std"]

[lib]
crate-type = ["rlib"]
1 change: 1 addition & 0 deletions musicxml/src/datatypes/above_below.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/accidental_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
3 changes: 2 additions & 1 deletion musicxml/src/datatypes/accordion_middle.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::string::{String, ToString};
use core::ops::Deref;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::DatatypeSerialize;
use std::ops::Deref;

/// May have values of 1, 2, or 3, corresponding to having 1 to 3 dots in the middle section of the accordion registration symbol.
///
Expand Down
3 changes: 2 additions & 1 deletion musicxml/src/datatypes/anyuri.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::string::{String, ToString};
use core::ops::Deref;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};
use std::ops::Deref;

/// See the definition in the [W3C XML Schema standard](https://www.w3.org/TR/xmlschema-2/#anyURI).
///
Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/arrow_direction.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/arrow_style.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/backward_forward.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/bar_style.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
3 changes: 2 additions & 1 deletion musicxml/src/datatypes/beam_level.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::string::{String, ToString};
use core::ops::Deref;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::DatatypeSerialize;
use std::ops::Deref;

/// Supports six levels of beaming, up to 1024th notes.
///
Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/beam_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/beater_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/bend_shape.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/breath_mark_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/caesura_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};

/// Represents the shape of the caesura sign.
Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/cancel_location.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/circular_arrow.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/clef_sign.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
6 changes: 3 additions & 3 deletions musicxml/src/datatypes/color.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use regex::Regex;
use std::fmt;

/// Indicates the color of an element.
///
Expand Down Expand Up @@ -33,8 +33,8 @@ impl Color {
}
}

impl fmt::Display for Color {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> fmt::Result {
impl core::fmt::Display for Color {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "aRGB({}, {}, {}, {})", self.a, self.r, self.g, self.b)
}
}
Expand Down
3 changes: 2 additions & 1 deletion musicxml/src/datatypes/comma_separated_text.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloc::{string::String, string::ToString, vec::Vec};
use core::ops::Deref;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use std::ops::Deref;

/// Used to specify a comma-separated list of text elements, as is used by the `font_family` attribute.
///
Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/css_font_size.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
6 changes: 3 additions & 3 deletions musicxml/src/datatypes/date.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use regex::Regex;
use std::fmt;

/// See the definition in the [W3C XML Schema standard](https://www.w3.org/TR/xmlschema-2/#date).
#[derive(Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -30,8 +30,8 @@ impl Date {
}
}

impl fmt::Display for Date {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> fmt::Result {
impl core::fmt::Display for Date {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(
f,
"{:04}-{:02}-{:02}{:+03}:{:02}",
Expand Down
3 changes: 2 additions & 1 deletion musicxml/src/datatypes/decimal.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::string::{String, ToString};
use core::ops::Deref;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};
use std::ops::Deref;

/// See the definition in the [W3C XML Schema standard](https://www.w3.org/TR/xmlschema-2/#decimal).
///
Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/degree_symbol_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/degree_type_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/distance_type.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};

/// Defines what type of distance is being defined in a [Distance][crate::elements::Distance] element.
Expand Down
3 changes: 2 additions & 1 deletion musicxml/src/datatypes/divisions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::string::{String, ToString};
use core::ops::Deref;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};
use std::ops::Deref;

/// Used to express values in terms of the musical divisions defined by the divisions element.
///
Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/effect_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/enclosure_shape.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
3 changes: 2 additions & 1 deletion musicxml/src/datatypes/ending_number.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use alloc::{string::String, string::ToString, vec::Vec};
use core::ops::Deref;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::DatatypeSerialize;
use regex::Regex;
use std::ops::Deref;

/// Used to specify either a comma-separated list of positive integers without leading zeros, or a string of zero or more spaces.
///
Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/fan.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/fermata_shape.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};

/// Represents the shape of the fermata sign.
Expand Down
3 changes: 2 additions & 1 deletion musicxml/src/datatypes/fifths.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::string::{String, ToString};
use core::ops::Deref;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::DatatypeSerialize;
use std::ops::Deref;

/// Represents the number of flats or sharps in a traditional key signature.
///
Expand Down
3 changes: 2 additions & 1 deletion musicxml/src/datatypes/font_family.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloc::{string::String, string::ToString, vec::Vec};
use core::ops::Deref;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use std::ops::Deref;

/// Comma-separated list of font names.
///
Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/font_size.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::css_font_size::CssFontSize;
use alloc::string::{String, ToString};
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};

/// Can be one of the [CSS font sizes](https://www.w3.org/2021/06/musicxml40/musicxml-reference/data-types/css-font-size/)
Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/font_style.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/font_weight.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/glass_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/glyph_type.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};

/// Defines what type of glyph is being defined in a [Glyph][crate::elements::Glyph] element.
Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/group_barline_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/group_symbol_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/handbell_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/harmon_closed_location.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/harmon_closed_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/harmony_arrangement.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/harmony_type.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/hole_closed_location.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/hole_closed_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
3 changes: 2 additions & 1 deletion musicxml/src/datatypes/id.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::string::{String, ToString};
use core::ops::Deref;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};
use std::ops::Deref;

/// See the definition in the [W3C XML Schema standard](https://www.w3.org/TR/xmlschema-2/#ID).
///
Expand Down
3 changes: 2 additions & 1 deletion musicxml/src/datatypes/idref.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::string::{String, ToString};
use core::ops::Deref;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};
use std::ops::Deref;

/// See the definition in the [W3C XML Schema standard](https://www.w3.org/TR/xmlschema-2/#IDREF).
///
Expand Down
3 changes: 2 additions & 1 deletion musicxml/src/datatypes/integer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::string::{String, ToString};
use core::ops::Deref;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};
use std::ops::Deref;

/// See the definition in the [W3C XML Schema standard](https://www.w3.org/TR/xmlschema-2/#integer).
///
Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/kind_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/left_center_right.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/left_right.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
1 change: 1 addition & 0 deletions musicxml/src/datatypes/line_end.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};

Expand Down
Loading

0 comments on commit d76831a

Please sign in to comment.