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

serde_avro - Access Header Details? #170

Open
pulltab opened this issue Dec 21, 2017 · 4 comments
Open

serde_avro - Access Header Details? #170

pulltab opened this issue Dec 21, 2017 · 4 comments

Comments

@pulltab
Copy link

pulltab commented Dec 21, 2017

I have a rather simple example of pulling length prefixed binaries off the wire and parsing Avro:

    let mut buf = Vec::with_capacity(4000);
    let payload_size_in_bytes = match reader.read_u32::<BigEndian>() {
        Ok(i) => i as usize,
        Err(_) => return,
    };
    buf.resize(payload_size_in_bytes, 0);
    if reader.read_exact(&mut buf).is_err() {
        return;
    }

    match serde_avro::de::Deserializer::from_container(&buf[..]) {
        Ok(avro_de) => {

        }

        Err(e) => {
            trace!("Failed to deserialize container: {:?}", e.description());
            return;
        }
    }

After constructing the deserializer successfully, is it possible for a user to get at the header details in anyway? I am interested in examining the "type" value indicated in the header.

@dflemstr
Copy link
Owner

I guess the parsed Header struct could be preserved in the deserializer, would that work for your use-case? How would you like that to look?

@pulltab
Copy link
Author

pulltab commented Dec 28, 2017

Just posting so that folks know I haven't forgotten about this thread.

I hope to have something to propose by end of week.

@pulltab
Copy link
Author

pulltab commented Dec 29, 2017

Warning - I am only journeyman level when it comes to Rust.

I made an attempt here -#171.

@mikaelstaldal
Copy link
Contributor

rq now uses avro-rs.

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

No branches or pull requests

3 participants