use std::pin::Pin;
use futures::{
future::Future,
task::{Context, Poll},
};
use crate::{peer_set::InventoryRegistry, BoxError};
#[derive(Debug)]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Update<'a> {
registry: &'a mut InventoryRegistry,
}
impl Unpin for Update<'_> {}
impl<'a> Update<'a> {
pub fn new(registry: &'a mut InventoryRegistry) -> Self {
Self { registry }
}
}
impl Future for Update<'_> {
type Output = Result<(), BoxError>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
self.registry.poll_inventory(cx)
}
}