Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

key argument name collision #230

Open
publicqi opened this issue Oct 23, 2024 · 0 comments
Open

key argument name collision #230

publicqi opened this issue Oct 23, 2024 · 0 comments

Comments

@publicqi
Copy link

Example:

#[cached]
fn foo(key: u64, b: u64) -> u64 {
    key + b
}

This will expand to

        ///This is a cached function that uses the [`FOO`] cached static.
        fn foo(key: u64, b: u64) -> u64 {
            use cached::Cached;
            use cached::CloneCached;
            let key = (key.clone(), b.clone());
            {
                let mut cache = FOO.lock().unwrap();
                if let Some(result) = cache.cache_get(&key) {
                    return result.to_owned();
                }
            }
            let result = foo_no_cache(key, b);
            let mut cache = FOO.lock().unwrap();
            cache.cache_set(key, result.clone());
            result
        }

Change the proc macro variable name to something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant