From af0a11c92bd531c9677bef31f6a6d8c4b59ad29b Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 30 Aug 2014 10:07:32 +0100 Subject: [PATCH] Update for lifetime changes --- phf/src/lib.rs | 24 ++++++++++++------------ phf_mac/src/lib.rs | 16 ++++++++-------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/phf/src/lib.rs b/phf/src/lib.rs index fed01609..9e5de946 100644 --- a/phf/src/lib.rs +++ b/phf/src/lib.rs @@ -42,7 +42,7 @@ mod shared; /// The fields of this struct are public so that they may be initialized by the /// `phf_map` macro. They are subject to change at any time and should never /// be accessed directly. -pub struct PhfMap { +pub struct PhfMap { #[doc(hidden)] pub key: u64, #[doc(hidden)] @@ -156,7 +156,7 @@ impl PhfMap { } /// An iterator over the key/value pairs in a `PhfMap`. -pub struct PhfMapEntries<'a, K, V> { +pub struct PhfMapEntries<'a, K:'a, V:'a> { iter: slice::Items<'a, (K, V)>, } @@ -179,7 +179,7 @@ impl<'a, K, V> DoubleEndedIterator<&'a (K, V)> for PhfMapEntries<'a, K, V> { impl<'a, K, V> ExactSize<&'a (K, V)> for PhfMapEntries<'a, K, V> {} /// An iterator over the keys in a `PhfMap`. -pub struct PhfMapKeys<'a, K, V> { +pub struct PhfMapKeys<'a, K:'a, V:'a> { iter: iter::Map<'a, &'a (K, V), &'a K, PhfMapEntries<'a, K, V>>, } @@ -202,7 +202,7 @@ impl<'a, K, V> DoubleEndedIterator<&'a K> for PhfMapKeys<'a, K, V> { impl<'a, K, V> ExactSize<&'a K> for PhfMapKeys<'a, K, V> {} /// An iterator over the values in a `PhfMap`. -pub struct PhfMapValues<'a, K, V> { +pub struct PhfMapValues<'a, K:'a, V:'a> { iter: iter::Map<'a, &'a (K, V), &'a V, PhfMapEntries<'a, K, V>>, } @@ -249,7 +249,7 @@ impl<'a, K, V> ExactSize<&'a V> for PhfMapValues<'a, K, V> {} /// The fields of this struct are public so that they may be initialized by the /// `phf_set` macro. They are subject to change at any time and should never be /// accessed directly. -pub struct PhfSet { +pub struct PhfSet { #[doc(hidden)] pub map: PhfMap } @@ -331,7 +331,7 @@ impl PhfSet { } /// An iterator over the values in a `PhfSet`. -pub struct PhfSetValues<'a, T> { +pub struct PhfSetValues<'a, T:'static> { iter: PhfMapKeys<'a, T, ()>, } @@ -381,7 +381,7 @@ impl<'a, T> ExactSize<&'a T> for PhfSetValues<'a, T> {} /// The fields of this struct are public so that they may be initialized by the /// `phf_ordered_map` macro. They are subject to change at any time and should /// never be accessed directly. -pub struct PhfOrderedMap { +pub struct PhfOrderedMap { #[doc(hidden)] pub key: u64, #[doc(hidden)] @@ -498,7 +498,7 @@ impl PhfOrderedMap { } /// An iterator over the entries in a `PhfOrderedMap`. -pub struct PhfOrderedMapEntries<'a, K, V> { +pub struct PhfOrderedMapEntries<'a, K:'a, V:'a> { iter: slice::Items<'a, (K, V)>, } @@ -533,7 +533,7 @@ impl<'a, K, V> RandomAccessIterator<&'a (K, V)> impl<'a, K, V> ExactSize<&'a (K, V)> for PhfOrderedMapEntries<'a, K, V> {} /// An iterator over the keys in a `PhfOrderedMap`. -pub struct PhfOrderedMapKeys<'a, K, V> { +pub struct PhfOrderedMapKeys<'a, K:'a, V:'a> { iter: iter::Map<'a, &'a (K, V), &'a K, PhfOrderedMapEntries<'a, K, V>>, } @@ -566,7 +566,7 @@ impl<'a, K, V> RandomAccessIterator<&'a K> for PhfOrderedMapKeys<'a, K, V> { impl<'a, K, V> ExactSize<&'a K> for PhfOrderedMapKeys<'a, K, V> {} /// An iterator over the values in a `PhfOrderedMap`. -pub struct PhfOrderedMapValues<'a, K, V> { +pub struct PhfOrderedMapValues<'a, K:'a, V:'a> { iter: iter::Map<'a, &'a (K, V), &'a V, PhfOrderedMapEntries<'a, K, V>>, } @@ -626,7 +626,7 @@ impl<'a, K, V> ExactSize<&'a V> for PhfOrderedMapValues<'a, K, V> {} /// The fields of this struct are public so that they may be initialized by the /// `phf_ordered_set` macro. They are subject to change at any time and should /// never be accessed directly. -pub struct PhfOrderedSet { +pub struct PhfOrderedSet { #[doc(hidden)] pub map: PhfOrderedMap, } @@ -706,7 +706,7 @@ impl PhfOrderedSet { } /// An iterator over the values in a `PhfOrderedSet`. -pub struct PhfOrderedSetValues<'a, T> { +pub struct PhfOrderedSetValues<'a, T:'a> { iter: PhfOrderedMapKeys<'a, T, ()>, } diff --git a/phf_mac/src/lib.rs b/phf_mac/src/lib.rs index 6381e55a..1d1f292f 100644 --- a/phf_mac/src/lib.rs +++ b/phf_mac/src/lib.rs @@ -114,7 +114,7 @@ struct HashState { map: Vec, } -fn expand_phf_map(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { +fn expand_phf_map(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { let entries = match parse_map(cx, tts) { Some(entries) => entries, None => return DummyResult::expr(sp) @@ -129,7 +129,7 @@ fn expand_phf_map(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box Box { +fn expand_phf_set(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { let entries = match parse_set(cx, tts) { Some(entries) => entries, None => return DummyResult::expr(sp) @@ -144,7 +144,7 @@ fn expand_phf_set(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box Box { +fn expand_phf_ordered_map(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { let entries = match parse_map(cx, tts) { Some(entries) => entries, None => return DummyResult::expr(sp), @@ -159,7 +159,7 @@ fn expand_phf_ordered_map(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box< create_ordered_map(cx, sp, entries, state) } -fn expand_phf_ordered_set(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { +fn expand_phf_ordered_set(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { let entries = match parse_set(cx, tts) { Some(entries) => entries, None => return DummyResult::expr(sp) @@ -394,7 +394,7 @@ fn try_generate_hash(entries: &[Entry], rng: &mut XorShiftRng) -> Option, state: HashState) - -> Box { + -> Box { let disps = state.disps.iter().map(|&(d1, d2)| { quote_expr!(&*cx, ($d1, $d2)) }).collect(); @@ -415,13 +415,13 @@ fn create_map(cx: &mut ExtCtxt, sp: Span, entries: Vec, state: HashState) } fn create_set(cx: &mut ExtCtxt, sp: Span, entries: Vec, state: HashState) - -> Box { + -> Box { let map = create_map(cx, sp, entries, state).make_expr().unwrap(); MacExpr::new(quote_expr!(cx, ::phf::PhfSet { map: $map })) } fn create_ordered_map(cx: &mut ExtCtxt, sp: Span, entries: Vec, state: HashState) - -> Box { + -> Box { let disps = state.disps.iter().map(|&(d1, d2)| { quote_expr!(&*cx, ($d1, $d2)) }).collect(); @@ -445,7 +445,7 @@ fn create_ordered_map(cx: &mut ExtCtxt, sp: Span, entries: Vec, state: Ha } fn create_ordered_set(cx: &mut ExtCtxt, sp: Span, entries: Vec, state: HashState) - -> Box { + -> Box { let map = create_ordered_map(cx, sp, entries, state).make_expr().unwrap(); MacExpr::new(quote_expr!(cx, ::phf::PhfOrderedSet { map: $map })) }