Struct minecraft_server_query::tokio::QueryClient
source · [−]pub struct QueryClient { /* private fields */ }
tokio
only.Expand description
An asynchronous Query client using the tokio
networking primitives.
Implementations
sourceimpl QueryClient
impl QueryClient
sourcepub async fn new(ip: &str) -> Result<Self>
pub async fn new(ip: &str) -> Result<Self>
Build a new QueryClient from the given IP address.
If not port is specified in the IP address, the default port is used.
The default timeout duration is used.
sourcepub async fn new_with_port(ip: &str, port: u16) -> Result<Self>
pub async fn new_with_port(ip: &str, port: u16) -> Result<Self>
Build a new QueryClient from the given IP address and port.
If the IP address already contains a port, an error is returned.
The default timeout duration is used.
sourcepub async fn new_with_socket_address(
ip: &str,
port: u16,
addr: impl ToSocketAddrs,
timeout: Option<Duration>
) -> Result<Self>
pub async fn new_with_socket_address(
ip: &str,
port: u16,
addr: impl ToSocketAddrs,
timeout: Option<Duration>
) -> Result<Self>
Builds a new QueryClient from the given IP address, port, socket address and optional timeout.
The IP adress must not contain a port.
sourcepub async fn recv(&self, buf: &mut [u8]) -> Result<usize>
pub async fn recv(&self, buf: &mut [u8]) -> Result<usize>
Receive a UDP packet from the client socket.
sourcepub async fn handshake(&self) -> Result<Token>
pub async fn handshake(&self) -> Result<Token>
Send a UDP handshake packet to the client socket.
Receive and parse the response into a Query token, valid up to 30 seconds.
sourcepub async fn basic_stat(&self, token: Token) -> Result<BasicStat>
pub async fn basic_stat(&self, token: Token) -> Result<BasicStat>
Request and wait for a basic status packet on the client socket.
If the token is no longer valid, no packet is received and an error is returned.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for QueryClient
impl Send for QueryClient
impl Sync for QueryClient
impl Unpin for QueryClient
impl UnwindSafe for QueryClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more