Skip to content

Instantly share code, notes, and snippets.

@caesaneer
Created February 10, 2022 03:56
Show Gist options
  • Save caesaneer/47a4101064ebd6fc8a51a5795131c102 to your computer and use it in GitHub Desktop.
Save caesaneer/47a4101064ebd6fc8a51a5795131c102 to your computer and use it in GitHub Desktop.
FRB
#![allow(unused_variables)]
use anyhow::Result;
use flutter_rust_bridge::StreamSink;
#[derive(Debug, Clone)]
pub struct MySize {
pub width: i32,
pub height: i32,
}
pub fn handle_stream(sink: StreamSink<MySize>, arg: String) -> Result<()> {
println!("handle_stream arg={}", arg);
for i in 0..5 {
sink.add(MySize {
width: 20,
height: 30,
});
}
sink.close();
Ok(())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment