Closed phstrauss closed 3 weeks ago
I've changed the jclient type to:
jclient: jack::AsyncClient<Notifications, jack::ClosureProcessHandler<dyn 'static + Send + FnMut(&jack::Client, &jack::ProcessScope) -> jack::Control>>,
and know the compiler seems straight to the point in its message:
error[E0277]: the size for values of type `(dyn for<'a, 'b> FnMut(&'a Client, &'b ProcessScope) -> Control + Send + 'static)` cannot be known at compilation time
--> src/app.rs:97:14
|
97 | ...t: jack::AsyncClient<Notifications, jack::ClosureProcessHandler<dyn 'static + Send + FnMut(&jack::Client, &jack::ProcessScope) -> jack::Control...
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn for<'a, 'b> FnMut(&'a Client, &'b ProcessScope) -> Control + Send + 'static)`
note: required by a bound in `ClosureProcessHandler`
--> /home/catseye/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jack-0.11.4/src/client/handler_impls.rs:16:34
|
16 | pub struct ClosureProcessHandler<F: 'static + Send + FnMut(&Client, &ProcessScope) -> Control> {
| ^ required by this bound in `ClosureProcessHandler`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `eframe_template` (lib) due to 1 previous error
How about:
pub struct SinePlot<N, P> {
line_plot: LinePlot, // egui plot
jclient: jack::AsyncClient<N, P>,
}
...
let sine_plot = SinePlot {
line_plot,
jclient,
}
Yup, thanks!
More probably a bug by me. In my first rust-jack (and even Rust, so be gentle with a beginner :) tryout, I would like to make a small oscilloscope and STFT spectrum analyzer using egui and rust-jack. I need to keep the client around in my code for stopping it on an input from the GUI, so (for now at least) I would like to write something along those lines:
But typing the result of async_client is not easy, nor having an allocation size for it it seems:
How do I write my interwoven GUI and jack code to keep the (async_)client around so that I can stop it once it is started?