stack_dst/value/
trait_impls.rs

1use core::future;
2use core::pin;
3use core::task;
4
5macro_rules! d {
6    ( $t:path; $($body:tt)* ) => {
7        impl<D: ::DataBuf, T: ?Sized> $t for super::Value<T, D>
8        where
9            T: $t,
10        {
11            $( $body )*
12        }
13    }
14}
15
16d! { future::Future;
17    type Output = T::Output;
18    fn poll(self: pin::Pin<&mut Self>, cx: &mut task::Context) -> task::Poll<Self::Output> {
19        unsafe { pin::Pin::new_unchecked(&mut **self.get_unchecked_mut()).poll(cx) }
20    }
21}
22d! { ::core::iter::Iterator;
23    type Item = T::Item;
24    fn next(&mut self) -> Option<Self::Item> {
25        (**self).next()
26    }
27}
28d! { ::core::iter::DoubleEndedIterator;
29    fn next_back(&mut self) -> Option<Self::Item> {
30        (**self).next_back()
31    }
32}
33d! { ::core::iter::ExactSizeIterator;
34}
35
36macro_rules! impl_fmt {
37    ( $( $t:ident )* ) => {
38        $(
39            d!{ ::core::fmt::$t;
40                fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
41                    (**self).fmt(f)
42                }
43            }
44        )*
45    }
46}
47impl_fmt! {
48    Display Debug UpperHex LowerHex
49}