Replies: 1 comment 3 replies
-
I figured it out: // Process each message
while let Ok(message_reader) = read_message(&mut cursor, capnp::message::ReaderOptions::default()) {
...
match event.which().unwrap() {
crate::log_capnp::event::Params(p) => {
if let Ok(p_reader) = p {
let mut builder: message::Builder<message::HeapAllocator> = message::Builder::new_default();
builder.set_root(p_reader);
let mut new_p_builder = builder.get_root::<crate::log_capnp::params::Builder>().unwrap();
new_p_builder .set_my_field(1234);
let new_p_reader: log_capnp::params::Reader = new_p_builder .into_reader();
// you can print the new_p_reader to prove its changed
}
},
... // more enum types
}
// Write the Builder to the output writer
write_message(&mut writer, &message_builder).unwrap();
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm struggling to figure out how to convert a Reader into a Builder.
I have a log file filled with messages labeled "Events." This log file contains sensitive user data, and I'm trying to remove it efficiently.
Beta Was this translation helpful? Give feedback.
All reactions