lending_iterator/lending_iterator/
impls.rs

1//! Boring impls go here.
2
3use super::*;
4
5#[gat]
6impl<'r, I : ?Sized + LendingIterator>
7    LendingIterator
8for
9    &'r mut I
10{
11    type Item<'next>
12    where
13        &'r mut I : 'next,
14    =
15        Item<'next, I>
16    ;
17
18    fn next<'next> (
19        self: &'next mut &'r mut I,
20    ) -> Option<Item<'next, Self>>
21    {
22        (*self).next()
23    }
24}
25
26#[gat]
27impl<'r, I : ?Sized + LendingIterator>
28    LendingIterator
29for
30    ::core::pin::Pin<&'r mut I>
31where
32    I : ::core::marker::Unpin,
33{
34    type Item<'next>
35    where
36        &'r mut I : 'next,
37    =
38        Item<'next, I>
39    ;
40
41    fn next<'next> (
42        self: &'next mut ::core::pin::Pin<&'r mut I>,
43    ) -> Option<Item<'next, Self>>
44    {
45        (&mut **self).next()
46    }
47}
48
49#[apply(cfg_alloc)]
50#[gat]
51impl<I : ?Sized + LendingIterator>
52    LendingIterator
53for
54    ::alloc::boxed::Box<I>
55{
56    type Item<'next>
57    where
58        ::alloc::boxed::Box<I> : 'next,
59    =
60        Item<'next, I>
61    ;
62
63    fn next<'next> (
64        self: &'next mut ::alloc::boxed::Box<I>,
65    ) -> Option<Item<'next, Self>>
66    {
67        (&mut **self).next()
68    }
69}
70
71#[apply(cfg_alloc)]
72#[gat]
73impl<I : ?Sized + LendingIterator>
74    LendingIterator
75for
76    ::core::pin::Pin<::alloc::boxed::Box<I>>
77where
78    I : ::core::marker::Unpin,
79{
80    type Item<'next>
81    where
82        ::core::pin::Pin<::alloc::boxed::Box<I>> : 'next,
83    =
84        Item<'next, I>
85    ;
86
87    fn next<'next> (
88        self: &'next mut ::core::pin::Pin<::alloc::boxed::Box<I>>,
89    ) -> Option<Item<'next, Self>>
90    {
91        (&mut **self).next()
92    }
93}