@@ -89,6 +89,8 @@ pub(crate) struct Options<A: AllowedOptions> {
8989 /// If this is `Some`, the value is the `<ident>`.
9090 pub id : Option < syn:: Path > ,
9191
92+ pub force_invalidation_on_cache_eviction : Option < syn:: Ident > ,
93+
9294 /// Remember the `A` parameter, which plays no role after parsing.
9395 phantom : PhantomData < A > ,
9496}
@@ -112,6 +114,7 @@ impl<A: AllowedOptions> Default for Options<A> {
112114 lru : Default :: default ( ) ,
113115 singleton : Default :: default ( ) ,
114116 id : Default :: default ( ) ,
117+ force_invalidation_on_cache_eviction : Default :: default ( ) ,
115118 }
116119 }
117120}
@@ -133,6 +136,7 @@ pub(crate) trait AllowedOptions {
133136 const LRU : bool ;
134137 const CONSTRUCTOR_NAME : bool ;
135138 const ID : bool ;
139+ const FORCE_INVALIDATION_ON_CACHE_EVICTION : bool ;
136140}
137141
138142type Equals = syn:: Token ![ =] ;
@@ -351,6 +355,20 @@ impl<A: AllowedOptions> syn::parse::Parse for Options<A> {
351355 "`id` option not allowed here" ,
352356 ) ) ;
353357 }
358+ } else if ident == "force_invalidation_on_cache_eviction" {
359+ if A :: FORCE_INVALIDATION_ON_CACHE_EVICTION {
360+ if let Some ( old) = options. force_invalidation_on_cache_eviction . replace ( ident) {
361+ return Err ( syn:: Error :: new (
362+ old. span ( ) ,
363+ "option `force_invalidation_on_cache_eviction` provided twice" ,
364+ ) ) ;
365+ }
366+ } else {
367+ return Err ( syn:: Error :: new (
368+ ident. span ( ) ,
369+ "`force_invalidation_on_cache_eviction` option not allowed here" ,
370+ ) ) ;
371+ }
354372 } else {
355373 return Err ( syn:: Error :: new (
356374 ident. span ( ) ,
0 commit comments