quick-xml icon indicating copy to clipboard operation
quick-xml copied to clipboard

Send events through channel

Open derolf opened this issue 3 years ago • 0 comments

Look at this broken piece of code:

  let mut xml = Reader::from_reader(...);
  let (tx, rx) = mpsc::channel::<Event>();
  let mut buf = Vec::new();
  
  loop {
      let ev = xml.read_event(&mut buf);
      tx.send(ev.unwrap());
  }
}

I'd like to decode the XML in one thread and send the events via a channel. Do you have a minimum example on how to do this?

derolf avatar Feb 17 '22 09:02 derolf