diff --git a/frb_example/dart_minimal/rust/src/api/minimal.rs b/frb_example/dart_minimal/rust/src/api/minimal.rs index 18d4148341..a5c2f3f6d2 100644 --- a/frb_example/dart_minimal/rust/src/api/minimal.rs +++ b/frb_example/dart_minimal/rust/src/api/minimal.rs @@ -9,10 +9,21 @@ pub fn minimal_adder(a: i32, b: i32) -> i32 { a + b } -pub trait MyTraitToBeUsedAsBoxDyn { - fn my_method_twin_normal(&self); +use std::fmt; +use std::fmt::Debug; + +/// Trait that logs at level INFO every update received (if any). +pub trait Progress: Send + Sync + 'static { + /// Send a new progress update. The progress value should be in the range 0.0 - 100.0, and the message value is an + /// optional text message that can be displayed to the user. + fn update(&self, progress: f32, message: Option); } -fn function_with_box_dyn_trait(arg: Box) { - let _ = arg; +pub struct ProgressHolder { + pub progress: Box, +} +impl Debug for ProgressHolder { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ProgressHolder").finish_non_exhaustive() + } }