odradev / odra

Odra framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple module requires prelude load.

zie1ony opened this issue · comments

This code:

#[odra::module]
pub struct Counter {
    value: odra::Var<u32>,
}

#[odra::module]
impl Counter {
    pub fn get_count(&self) -> u32 {
        self.value.get_or_default()
    }

    pub fn increment(&mut self) {
        self.value.set(self.get_count() + 1);
    }
}

yelds error:

cannot find macro `vec` in this scope...
consider importing one of these items: `use alloc::vec`, `use odra::prelude::vec`;
``