Expand description
ChordPro ↔ iReal Pro format-conversion bridge.
Bidirectional converter tracked under #2050. Both directions are now implemented:
- iReal → ChordPro (#2053)
— near-lossless; lives in
crate::from_ireal. - ChordPro → iReal (#2061)
— lossy (lyrics drop, fonts / colours / capo dropped); lives
in
crate::to_ireal. Every drop surfaces as aConversionWarningso callers never silently lose data.
§Layout
Converteris the generic trait every direction implements. Free functionschordpro_to_irealandireal_to_chordprowrap the trait implementations for ergonomics. New formats (MusicXML, Guitar Pro, etc.) plug in as additionalConverterimplementations or as their own crates that depend on this one for the warning / error vocabulary.ConversionOutputpairs the converted value with aConversionWarninglist so callers can surface lossy transformations without parsing the error type.ConversionErrorenumerates the reasons a conversion can fail. TheNotImplementedvariant is the placeholder every pre-implementation function currently returns.
§Why a separate crate from chordsketch-convert-musicxml
chordsketch-convert-musicxml predates this crate and binds the
ChordPro AST to MusicXML directly via free functions. The new
chordsketch-convert crate is the conversion home for formats
that share a small intermediate concept set (warnings, lossy
drops, approximations) — namely the ChordPro ↔ iReal bridge and
its expected MusicXML / Guitar Pro siblings. Consolidating the
musicxml converter into this crate is tracked in a future
cleanup; it would be a breaking change that does not block
v0.3.0.
§Stability
Pre-1.0 — the trait surface is intentionally narrow so the
follow-up issues can fill in implementations without breaking
the bindings or CLI. ConversionError and WarningKind
are both #[non_exhaustive], so adding a new variant is
non-breaking for downstream match expressions; renaming an
existing variant remains breaking.
§Example
use chordsketch_chordpro::ast::Song;
use chordsketch_convert::chordpro_to_ireal;
let song = Song::new();
let result = chordpro_to_ireal(&song).expect("conversion succeeds");
// An empty source produces an empty `IrealSong` with no
// warnings — there is no metadata, no lyrics, and no
// sections to drop.
assert!(result.warnings.is_empty());Re-exports§
pub use error::ConversionError;pub use error::ConversionWarning;pub use error::WarningKind;pub use ireal::ChordProToIreal;pub use ireal::IrealToChordPro;pub use ireal::chordpro_to_ireal;pub use ireal::ireal_to_chordpro;
Modules§
- error
- Error and warning types shared by every conversion direction.
- from_
ireal - iReal Pro → ChordPro conversion (#2053).
- ireal
- ChordPro ↔ iReal Pro converter dispatch.
- to_
ireal - ChordPro → iReal Pro conversion (#2061).
Structs§
- Conversion
Output - Result of a successful conversion.
Traits§
- Converter
- A converter that transforms
SourceintoTarget.
Functions§
- version
- Returns the library version (the workspace
Cargo.tomlversionfield, baked in at compile time).