Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement std::fmt::Display for all OSC types #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

douglasfinlay
Copy link

Implement the std::fmt::Display trait for OscPacket, OscType, and related types. This is to facilitate cleaner log output in consuming projects.

OscType

Message argument values are prepended by the appropriate type tag as defined in the OSC 1.0 spec.

Variant Formatted Ouptut
OscType::Int (i) 123
OscType::Float (f) 123.4
OscType::String (s) abc
OscType::Blob (b) 0x000102FF
OscType::Time (t) 1970-01-01T00:00:00.000000000Z
OscType::Long (h) 123
OscType::Double (d) 123.4
OscType::Char (c) a
OscType::Color (r) {255,127,63,255}
OscType::Midi (m) {port:3, status:0xF0, data:0x1234}
OscType::Bool (T) or (F)
OscType::Array [(i) 123,(f) 123.4,(s) abc]
OscType::Nil (N)
OscType::Inf (I)

OscPacket (Message)

/oscillator/1/frequency, (f) 123.4, (T)

OscPacket (Bundle)

#bundle 1970-01-01T00:00:00.000000000Z { /oscillator/1/frequency, (f) 123.4, (T); /oscillator/2/frequency, (f) 246.8, (F); #bundle 1970-01-01T00:00:00.000000000Z { /oscillator/3/frequency, (f) 123.4, (T) } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant