[−][src]Enum network_audio_protocol::DataType
A listing of data types used to compose Get and Reply Messages
Description
The Data Type enum variants are used to specify what data is contained in a Message, it comes
directly after the Message Type, and is only relevant for MessageType::Get
and
MessageType::Reply
Messages. Each variant as a mapping to a u8 integer.
u8 Variant Mappings
Null == 0
SampleRate == 1
SampleFormat == 2
ChannelCount == 3
AudioSamples == 4
Unknown >= 5
Examples
use network_audio_protocol::DataType; // create a DataType variant from the integer 1 let data_type: DataType = DataType::from(1); // turn the DataType variant into a string let as_string: String = data_type.to_string(); // check for valid results assert_eq!(DataType::SampleRate, data_type); assert_eq!(String::from("SampleRate"), as_string); // print out the DataType variant, and its u8 integer mapping println!("Data Type: {}, maps to: {}", data_type, data_type.as_u8());
Variants
Used to send a Message whithout a data type.
Used to send a message requesting / containing the audio sample rate or frequency.
SampleRate
is represented as a u32
integer.
Used to send a message requesting / containing the audio data sample format. SampleFormat
is represented as (bool, bool, u32)
tuple, where the first boolean is the Endianness of the
samples (true == Little Endian)
, the second boolean is the Signedness of the samples (true == Signed)
, and the u32
is the bit depth of the samples.
Used to send a message requesting / containing the number of audio channels. ChannelCount
is represented as a u32
integer.
Used to send a message requesting / containing audio samples / audio data. AudioSamples
are represented as a u8
slice, or &[u8]
. The Endianness and Signedness
of the bytes is not altered when the message is serialized / deserialized.
Not formally used in composing messages, but rather for specifying that a message is made up of an unknown, or undefined data type.
Implementations
impl DataType
[src]
Trait Implementations
impl Debug for DataType
[src]
impl Display for DataType
[src]
impl From<u8> for DataType
[src]
impl PartialEq<DataType> for DataType
[src]
impl StructuralPartialEq for DataType
[src]
Auto Trait Implementations
impl RefUnwindSafe for DataType
impl Send for DataType
impl Sync for DataType
impl Unpin for DataType
impl UnwindSafe for DataType
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,