From 31fb6ce81b4699af4a699cb7c4c583d1e66f6c6a Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Wed, 3 Jul 2024 09:28:58 +0800 Subject: [PATCH] more repro --- .../dart_minimal/rust/src/api/minimal.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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() + } }