| Crates.io | osc-adapter-osc-types |
| lib.rs | osc-adapter-osc-types |
| version | 0.1.0-alpha.3 |
| created_at | 2025-10-27 03:00:11.479946+00 |
| updated_at | 2025-10-27 04:38:53.363203+00 |
| description | Adapter between osc-ir and rust-osc-types for bidirectional conversion |
| homepage | https://github.com/Nagitch/osc-data-model |
| repository | https://github.com/Nagitch/osc-data-model |
| max_upload_size | |
| id | 1902166 |
| size | 18,443 |
⚠️ EXPERIMENTAL ⚠️
This crate is experimental and APIs may change significantly between versions.
Bidirectional adapter between osc-ir intermediate representation and rust-osc-types for seamless conversion between OSC data formats.
IrValue and OSC types from rust-osc-typesallocAdd this to your Cargo.toml:
[dependencies]
osc-adapter-osc-types = { version = "0.1.0-alpha.1", features = ["osc10"] }
[dependencies]
osc-adapter-osc-types = { version = "0.1.0-alpha.1", features = ["osc10"] }
[dependencies]
osc-adapter-osc-types = { version = "0.1.0-alpha.1", features = ["osc11"] }
use osc_adapter_osc_types::{osc_to_ir, ir_to_osc};
use osc_ir::IrValue;
// Convert OSC message to IR
let osc_msg = /* your OSC message */;
let ir_value = osc_to_ir(&osc_msg);
// Convert back to OSC
let restored_osc = ir_to_osc(&ir_value);
use osc_adapter_osc_types::{message_to_ir, ir_to_message};
use osc_ir::IrValue;
// Create an OSC message representation in IR
let address = "/oscillator/frequency";
let args = vec![
IrValue::from(440.0), // frequency
IrValue::from("sine") // waveform
];
let ir_message = message_to_ir(address, args);
// Convert IR back to OSC message format
if let Some((addr, arguments)) = ir_to_message(&ir_message) {
println!("Address: {}", addr);
println!("Arguments: {:?}", arguments);
}
The adapter handles conversion between OSC types and IR values:
i32 ↔ IrValue::Integerf32 ↔ IrValue::FloatString ↔ IrValue::StringVec<u8> ↔ IrValue::BinaryIrValue::ArrayIrValue::Timestamposc10: Enable OSC 1.0 support (basic types, bundles, timetags)osc11: Enable OSC 1.1 support (includes OSC 1.0 plus additional types)Choose the appropriate feature flag based on the OSC version you need to support.
osc_to_ir(osc: &OscType) -> IrValue - Convert OSC type to IRir_to_osc(ir: &IrValue) -> OscType - Convert IR to OSC typemessage_to_ir(address: &str, args: Vec<IrValue>) -> IrValue - Create IR messageir_to_message(ir: &IrValue) -> Option<(&str, &[IrValue])> - Extract message from IRThis adapter is designed to work with:
osc-ir for intermediate representationrust-osc-types for OSC protocol implementationosc-codec-json and osc-codec-msgpack for serializationLicensed under either of
at your option.