Mercurial > lbo > hg > memoize
changeset 30:3be4519e3838
Rename parameter SecondsToLive -> TimeToLive
author | Илья Ефимов <inferrna@gmail.com> |
---|---|
date | Thu, 10 Dec 2020 22:48:52 +0800 |
parents | eccea761a854 |
children | 102b185d2013 |
files | examples/test1.rs src/lib.rs |
diffstat | 2 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/test1.rs Thu Dec 10 22:41:18 2020 +0800 +++ b/examples/test1.rs Thu Dec 10 22:48:52 2020 +0800 @@ -9,7 +9,7 @@ i: Instant, } -#[memoize(Capacity: 123, SecondsToLive: Duration::from_secs(2))] +#[memoize(Capacity: 123, TimeToLive: Duration::from_secs(2))] fn hello(key: String) -> ComplexStruct { println!("hello: {}", key); ComplexStruct {
--- a/src/lib.rs Thu Dec 10 22:41:18 2020 +0800 +++ b/src/lib.rs Thu Dec 10 22:48:52 2020 +0800 @@ -66,7 +66,7 @@ } syn::custom_keyword!(Capacity); - syn::custom_keyword!(SecondsToLive); + syn::custom_keyword!(TimeToLive); syn::custom_punctuation!(Colon, :); // To extend option parsing, add functionality here. @@ -80,8 +80,8 @@ return Ok(CacheOption::LRUMaxEntries(cap.base10_parse()?)); } - if la.peek(SecondsToLive) { - let _: SecondsToLive = input.parse().unwrap(); + if la.peek(TimeToLive) { + let _: TimeToLive = input.parse().unwrap(); let _: Colon = input.parse().unwrap(); let cap: syn::ExprCall = input.parse().unwrap();