1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use std::future::IntoFuture;

use crate::{model::RenderServers, request::Request, routing::Route, ClientError, OrdrClient};

use super::OrdrFuture;

/// Get [`RenderServers`].
#[must_use]
pub struct GetServerList<'a> {
    ordr: &'a OrdrClient,
}

impl<'a> GetServerList<'a> {
    pub(crate) const fn new(ordr: &'a OrdrClient) -> Self {
        Self { ordr }
    }
}

impl IntoFuture for &mut GetServerList<'_> {
    type Output = Result<RenderServers, ClientError>;
    type IntoFuture = OrdrFuture<RenderServers>;

    fn into_future(self) -> Self::IntoFuture {
        self.ordr.request(Request::from_route(Route::ServerList))
    }
}

impl IntoFuture for GetServerList<'_> {
    type Output = Result<RenderServers, ClientError>;
    type IntoFuture = OrdrFuture<RenderServers>;

    fn into_future(mut self) -> Self::IntoFuture {
        (&mut self).into_future()
    }
}