-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Description
Hi.
I don't know why this isn't possible yet, and while searching the issues I did not find something that answered my questions: Why is there no caching for member functions?
Consider:
pub struct Foo(i32, i32);
impl Foo {
#[cached]
pub fn get_first(&self) -> i32 { /* ... */ }
#[cached]
pub fn get_snd(&self) -> i32 { /* ... */ }
}That's actually not that hard to cache, is it? Maybe I'm missing some important pieces here, I don't know...
That being said, one could easily craft a type which just calls (cached) free private functions, like so:
pub struct Foo(i32, i32);
impl Foo {
pub fn get_first(&self) -> i32 { foo_get_first(self) }
pub fn get_snd(&self) -> i32 { foo_get_snd(self) }
}
#[cached]
fn foo_get_first(f: &Foo) -> i32 { /* ... */ }
#[cached]
fn foo_get_snd(f: &Foo) -> i32 { /* ... */ }right? That'd yield the same, AFAICS?
schneiderfelipe and Xoffio
Metadata
Metadata
Assignees
Labels
No labels