Function nannou_osc::encoder::encode[][src]

pub fn encode(packet: &OscPacket) -> Result<Vec<u8, Global>, OscError>
Expand description

Takes a reference to an OSC packet and returns a byte vector on success. If the packet was invalid an OscError is returned.

Example

use rosc::{OscPacket,OscMessage,OscType};
use rosc::encoder;

let packet = OscPacket::Message(OscMessage{
        addr: "/greet/me".to_string(),
        args: Some(vec![OscType::String("hi!".to_string())])
    }
);
assert!(encoder::encode(&packet).is_ok())