Generic type in Shared
hanusek opened this issue · comments
Hello.
I have a problem with the Generic type in the Shared struct.
How to fix it?
struct Test<T>
{
x: T
}
impl<T> Test<T>
{
pub fn new(x: T) -> Self
{
Test{x}
}
}
#[shared]
struct Shared
{
t: Test<T>
}
#[init]
fn init(cx: init::Context) -> (Shared<T>, Local, init::Monotonics) { }
error:
error: the `#[init]` function must have signature `fn(init::Context) -> (Shared resources struct, Local resources struct, init::Monotonics)`
--> app/src/main.rs:138:8
|
138 | fn init(cx: init::Context) -> (Shared<T>, Local, init::Monotonics) {
| ^^^^
Hi,
Generics are not supported in the Shared
or Local
structs.
You need to give it a specific type, eg t: Test<u32>
.