Hello, I’m struggling to find an answer online and I’m pretty new to rust.
I’m currently trying to build a custom object with a toggle as a child. The toggle needs to use datas that are stored in a custom struct. The issue I’m facing is that this struct is instantiated from a library that I built which does not include GTK and .property requires a glib value.
So this is where i’m struggling :
use my_lib::MyCustomStruct;
impl CustomObject {
pub fn new(label1: &str, status: bool, label2: &str, custom_struct: MyCustomStruct) -> Self {
Object::builder()
.property("label1", label1)
.property("status", status)
.property("label2", label2)
.property("custom-struct", custom_struct)
.build()
}
}
But here’s the error I’m facing : the trait bound `Value: From` is not satisfied
So I assume I have to implement a From for glib::Value, but I feel kind of lost there. I don’t really know where to go from there, because whenever I type something like this, I have other errors caused by the fact that the struct is not defined in the current crate.
For a better understanding, I need data stored in MyCustomStruct because they are used to build paths to items. These are 2 String and 2 Option.
Am I missing something? Is there a fix or a workaround?
Thank you for the time spent reading & answering me!