Crate arrowvortex_clipboard[][src]

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

Singular note

Singular tempo event

Enums

Error in decode call

Possible contents of ArrowVortex clipboard data. Returned by decode().

Error that may occur during any of the encoding functions

Note-type specific data

Tempo event type specific data

Functions

Decodes a byte buffer into an iterator of Note

Encodes a list of row-based Notes into the given writer

Encodes a list of tempo events into the given writer

Encodes a list of time-based Notes into the given writer