Hello Folks - I’ve got a quick question for the Rust-Mega-Brains out there… I’m still trying to get my head around rust.
Is it possible to have generics in structs and save these into memory inside a canister? For example
pub struct ExampleData<T,U> {
pub data_one: Vec<T>,
pub data_two: Vec<U>,
}
thread_local! {
static RUNTIME_STATE: RefCell<ExampleData<T,U>> = RefCell::default(); // wont work!!
}
My understanding is that using a static variable for runtime state does not allow generic types as the size is not known at compile time.
Is there any way around this - or must all structs on the IC be defined?
Thanks!