Skip to content

Commit

Permalink
more repro
Browse files Browse the repository at this point in the history
  • Loading branch information
fzyzcjy committed Jul 3, 2024
1 parent 5c0b35b commit 31fb6ce
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions frb_example/dart_minimal/rust/src/api/minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>);
}

fn function_with_box_dyn_trait(arg: Box<dyn MyTraitToBeUsedAsBoxDyn>) {
let _ = arg;
pub struct ProgressHolder {
pub progress: Box<dyn Progress>,
}
impl Debug for ProgressHolder {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ProgressHolder").finish_non_exhaustive()
}
}

0 comments on commit 31fb6ce

Please sign in to comment.