Browse Source

read_bundle_element → read_bundle_element_content

Thanks to @glindstedt for mentioning this inconsistency.

Previously there was `read_bundle_element` and
`read_bundle_element_size` where the first one was confusing since a
bundle element consists of its size and contents but the method only
read the contents.
tags/v0.4.2
Andreas Linz 1 month ago
parent
commit
b2608e35c8
Signed by: alinz <klingt.net@gmail.com> GPG Key ID: 9BF39809C9DA580C
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/decoder.rs

+ 2
- 2
src/decoder.rs View File

@@ -67,7 +67,7 @@ fn decode_bundle(msg: &[u8]) -> Result<OscPacket> {
let mut elem_size = read_bundle_element_size(&mut cursor)?;

while msg.len() >= (cursor.position() as usize) + elem_size {
let packet = read_bundle_element(&mut cursor, elem_size)?;
let packet = read_bundle_element_content(&mut cursor, elem_size)?;
bundle.push(packet);

if msg.len() == cursor.position() as usize {
@@ -90,7 +90,7 @@ fn read_bundle_element_size(cursor: &mut io::Cursor<&[u8]>) -> Result<usize> {
.map_err(OscError::ReadError)
}

fn read_bundle_element(cursor: &mut io::Cursor<&[u8]>, elem_size: usize) -> Result<OscPacket> {
fn read_bundle_element_content(cursor: &mut io::Cursor<&[u8]>, elem_size: usize) -> Result<OscPacket> {
let mut buf: Vec<u8> = Vec::with_capacity(elem_size);

let mut handle = cursor.take(elem_size as u64);


Loading…
Cancel
Save