rosu_render/request/
server_online_count.rs

1use std::future::IntoFuture;
2
3use crate::{model::ServerOnlineCount, request::Request, routing::Route, ClientError, OrdrClient};
4
5use super::OrdrFuture;
6
7/// Get [`ServerOnlineCount`].
8#[must_use]
9pub struct GetServerOnlineCount<'a> {
10    ordr: &'a OrdrClient,
11}
12
13impl<'a> GetServerOnlineCount<'a> {
14    pub(crate) const fn new(ordr: &'a OrdrClient) -> Self {
15        Self { ordr }
16    }
17}
18
19impl IntoFuture for &mut GetServerOnlineCount<'_> {
20    type Output = Result<ServerOnlineCount, ClientError>;
21    type IntoFuture = OrdrFuture<ServerOnlineCount>;
22
23    fn into_future(self) -> Self::IntoFuture {
24        self.ordr
25            .request(Request::from_route(Route::ServerOnlineCount))
26    }
27}
28
29impl IntoFuture for GetServerOnlineCount<'_> {
30    type Output = Result<ServerOnlineCount, ClientError>;
31    type IntoFuture = OrdrFuture<ServerOnlineCount>;
32
33    fn into_future(mut self) -> Self::IntoFuture {
34        (&mut self).into_future()
35    }
36}