this post was submitted on 05 Aug 2023
7 points (100.0% liked)

Rust Programming

8219 readers
1 users here now

founded 5 years ago
MODERATORS
 

Im trying to use iced for the gui in an audio plug in I'm building, but I keep seeing discrepancies in how to accomplish this.

On the iced github page, it says that to implement the Sandbox trait, you use this signature: fn view(&self), yet in the documentation it says to use view(&mut self). When I try to use the non-mut version, I get an error saying that it expects self to be mutable.

I also stumbled across iced-pure, which seems like a better idea. But I need to use a NumberInput widget from the iced-aw crate. Unfortunately, these widgets are not pure.

So how do I go about creating a gui using NumberInput? Do I need to create the widgets myself to make them pure? I'd like to use other widgets from the iced-aw crate too, so that wouldn't be ideal

Or do i have to use the mutable version of view? If so, why does github say to use non mutable? Is this specific to certain versions of iced? If the newer version of iced uses a non mutable view function, does that mean it's pure? Have the iced-pure changes been merged into iced?

top 11 comments
sorted by: hot top controversial new old
[–] Solemarc 2 points 1 year ago (1 children)

I think you mean to say "no documentation". First of all, what version of iced are you using? I made a simple GUI app in version 0.7 but with the current version of 0.10 it's broken. Unfortunately if you can't solve your problem using the examples repo your probably out of luck until iced is more stable and better documented.

[–] Barbacamanitu 1 points 1 year ago (2 children)

I decided to give up. Iced just isn't a mature enough gui framework and the alternatives don't look great either.

I restarted my plug in project using JUCE tonight and I already have the gui started. It's c++, so that sucks, but oh well

[–] [email protected] 1 points 1 year ago (1 children)

@Barbacamanitu @Solemarc

I'd like to hear your thoughts about Tauri and Dioxus.

[–] Solemarc 1 points 1 year ago

I know react so Dioxus was easy for me to pick up. I haven't tried tauri but I know React, Vue and Svelte pretty well so I assume I'd be golden with it as well

[–] [email protected] 1 points 1 year ago (1 children)

What GUI framework did you end up using in C++? Qt?

[–] Barbacamanitu 1 points 1 year ago (1 children)

I started trying out JUCE. It's a framework for making audio plugins (VSTs). Though I think I'm going to give the rust solution another shot with Vizia.

[–] [email protected] 1 points 1 year ago (1 children)

Vizia looks really nice, but the book only covers a counter example... Sadly, this is the state of most Rust GUI libraries at the moment...

[–] Barbacamanitu 1 points 1 year ago

Right? What's with that? It's like everyone gets their crate to the minimal working state and stops workings on it.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (1 children)

Have no experience with iced but interesting. Can you share a minimal example of what you'd like to do? At least the source code of Sandbox reads fn view(&self).

[–] Barbacamanitu 1 points 1 year ago (1 children)

I don't have a minimal example yet because I haven't been able to get it working. The framework I'm using (nih-plug) uses a specific version of iced though, so I'm going to try to just model mine off their example. I don't think it uses the pure version.

[–] [email protected] 1 points 1 year ago

Starting from a working example is always a good idea :) then once things start breaking you might have a clue why.