Crate arrowvortex_clipboard

Crate arrowvortex_clipboard 

Source
Expand description

Small library for encoding and decoding ArrowVortex clipboard data. Ported from av-clipboard-lib, a Python libary by DeltaEpsilon.

Main credit goes to DeltaEpsilon for reverse-engineering ArrowVortex’ clipboard functions and implementing the first ArrowVortex clipboard library.

// EtternaOnline noteskin template pattern (https://etternaonline.com/noteskins)
let data = r#"ArrowVortex:notes:!"8i-K)chjJHuM^!#P_Z![IjrJi#:bJ2UO3!BC3L"%E"#;

// Decode string into Vec<Note>
let notes = match arrowvortex_clipboard::decode(data.as_bytes())? {
    arrowvortex_clipboard::DecodeResult::RowBasedNotes(notes) => notes,
    _ => panic!("Unexpected data type"),
};
println!("{:?}", notes);

// Encode &[Note] into string
let buffer = arrowvortex_clipboard::encode_row_based_notes(&notes)?;
println!("{}", buffer);

// Verify that string stayed identical after roundtrip
assert_eq!(data, buffer);

Structs§

Note
Singular note
TempoEvent
Singular tempo event

Enums§

DecodeError
Error in decode call
DecodeResult
Possible contents of ArrowVortex clipboard data. Returned by decode().
EncodeError
Error that may occur during any of the encoding functions
NoteKind
Note-type specific data
TempoEventKind
Tempo event type specific data

Functions§

decode
Decodes a byte buffer into an iterator of Note
encode_row_based_notes
Encodes a list of row-based Notes into the given writer
encode_tempo
Encodes a list of tempo events into the given writer
encode_time_based_notes
Encodes a list of time-based Notes into the given writer