Skip to main content

OscMessage

Struct OscMessage 

Source
pub struct OscMessage {
    pub address: String,
    pub arguments: Vec<OscArgument>,
}
Expand description

Represents an OSC message

Fields§

§address: String§arguments: Vec<OscArgument>

Implementations§

Source§

impl OscMessage

Source

pub fn new(address: impl Into<String>) -> Self

Constructs a new OscMessage with a given address and zero arguments

Source

pub fn with_arg(self, arg: OscArgument) -> Self

Adds an argument to the OscMessage and returns the modified message

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, OscParseError>

Construct an OscMessage from a sequence of bytes

Source

pub fn to_string(&self) -> String

Construct an OscMessage from a sequence of bytes

Examples found in repository?
examples/receive_messages.rs (line 10)
4fn main() {
5    let listen_port = 9000;
6    let receiver = OscReceiver::new(listen_port).unwrap();
7
8    loop {
9        match receiver.get_messages() {
10            Ok(OscPacket::Message(msg)) => println!("Got message: {}", msg.to_string()),
11            Ok(OscPacket::Bundle(bundle)) => println!("Got bundle: {:?}", bundle.time_tag.seconds),
12            Err(err) => eprintln!("Parse error: {:?}", err),
13        }
14    }
15}
Source

pub fn to_bytes(&self) -> Vec<u8>

Convert an OscMessage to a vector of bytes

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.