pub struct Connection { /* private fields */ }
Expand description
Represents a single-established RCON connection to the server, which will not automatically reconnect once the connection has failed.
This struct will instead opt to return IO errors
, leaving connection responsibility in the callers hands.
§Example
use rercon::{Connection, Settings};
#[tokio::main]
async fn main() {
let mut connection = Connection::open("123.456.789.123:27020", "my_secret_password", Settings::default()).await.unwrap();
let reply = connection.exec("hello").await.unwrap();
println!("Reply from server: {}", reply);
}
Implementations§
Source§impl SingleConnection
impl SingleConnection
Sourcepub async fn open(
address: impl ToSocketAddrs,
pass: impl ToString,
settings: Settings,
) -> Result<Self, RconError>
pub async fn open( address: impl ToSocketAddrs, pass: impl ToString, settings: Settings, ) -> Result<Self, RconError>
Opens a new RCON connection, with an optional timeout, and authenticates the connection to the remote server. If connect_timeout is set to None, a default timeout of 10 seconds will be used.
Auto Trait Implementations§
impl Freeze for SingleConnection
impl RefUnwindSafe for SingleConnection
impl Send for SingleConnection
impl Sync for SingleConnection
impl Unpin for SingleConnection
impl UnwindSafe for SingleConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more