Skip to content

key argument name collision #230

Open
@publicqi

Description

@publicqi

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions