karma_p2p/futures/
fetch_local_addr.rs1use std::{
2 pin::Pin,
3 task::{Context, Poll},
4};
5
6use futures_lite::Future;
7
8use crate::P2pSocket;
9
10pub struct FetchLocalAddrFuture<'a, T: P2pSocket> {
11 pub socket: &'a mut T,
12}
13
14impl<'a, T> Future for FetchLocalAddrFuture<'a, T>
15where
16 T: P2pSocket + Unpin,
17 T::Addr: Unpin,
18{
19 type Output = Result<T::Addr, T::Error>;
20
21 fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
22 let mut this = self;
23
24 let socket = &mut *this.socket;
25
26 Pin::new(socket).poll_fetch_local_addr(cx)
27 }
28}