Lines Matching refs:Pair

182     pub fn pop(&mut self) -> Option<Pair<T, P>> {
184 self.last.take().map(|t| Pair::End(*t))
186 self.inner.pop().map(|(t, p)| Pair::Punctuated(t, p))
453 impl<T, P> FromIterator<Pair<T, P>> for Punctuated<T, P> {
454 fn from_iter<I: IntoIterator<Item = Pair<T, P>>>(i: I) -> Self {
461 impl<T, P> Extend<Pair<T, P>> for Punctuated<T, P>
465 fn extend<I: IntoIterator<Item = Pair<T, P>>>(&mut self, i: I) {
475 I: Iterator<Item = Pair<T, P>>,
480 panic!("Punctuated extended with items after a Pair::End");
483 Pair::Punctuated(a, b) => punctuated.inner.push((a, b)),
484 Pair::End(a) => {
531 /// An iterator over borrowed pairs of type `Pair<&T, &P>`.
542 type Item = Pair<&'a T, &'a P>;
547 .map(|(t, p)| Pair::Punctuated(t, p))
548 .or_else(|| self.last.next().map(Pair::End))
560 .map(Pair::End)
561 .or_else(|| self.inner.next_back().map(|(t, p)| Pair::Punctuated(t, p)))
581 /// An iterator over mutably borrowed pairs of type `Pair<&mut T, &mut P>`.
592 type Item = Pair<&'a mut T, &'a mut P>;
597 .map(|(t, p)| Pair::Punctuated(t, p))
598 .or_else(|| self.last.next().map(Pair::End))
610 .map(Pair::End)
611 .or_else(|| self.inner.next_back().map(|(t, p)| Pair::Punctuated(t, p)))
621 /// An iterator over owned pairs of type `Pair<T, P>`.
632 type Item = Pair<T, P>;
637 .map(|(t, p)| Pair::Punctuated(t, p))
638 .or_else(|| self.last.next().map(Pair::End))
650 .map(Pair::End)
651 .or_else(|| self.inner.next_back().map(|(t, p)| Pair::Punctuated(t, p)))
927 pub enum Pair<T, P> {
932 impl<T, P> Pair<T, P> {
937 Pair::Punctuated(t, _) | Pair::End(t) => t,
944 Pair::Punctuated(t, _) | Pair::End(t) => t,
951 Pair::Punctuated(t, _) | Pair::End(t) => t,
959 Pair::Punctuated(_, p) => Some(p),
960 Pair::End(_) => None,
984 Pair::Punctuated(_, p) => Some(p),
985 Pair::End(_) => None,
993 Some(p) => Pair::Punctuated(t, p),
994 None => Pair::End(t),
1002 Pair::Punctuated(t, p) => (t, Some(p)),
1003 Pair::End(t) => (t, None),
1010 impl<T, P> Pair<&T, &P> {
1011 pub fn cloned(self) -> Pair<T, P>
1017 Pair::Punctuated(t, p) => Pair::Punctuated(t.clone(), p.clone()),
1018 Pair::End(t) => Pair::End(t.clone()),
1025 impl<T, P> Clone for Pair<T, P>
1032 Pair::Punctuated(t, p) => Pair::Punctuated(t.clone(), p.clone()),
1033 Pair::End(t) => Pair::End(t.clone()),
1040 impl<T, P> Copy for Pair<T, P>
1093 impl<T, P> ToTokens for Pair<T, P>
1100 Pair::Punctuated(a, b) => {
1104 Pair::End(a) => a.to_tokens(tokens),