Skip to main content

NurtexConnection

Struct NurtexConnection 

Source
pub struct NurtexConnection { /* private fields */ }
Expand description

Основная структура подключения

Implementations§

Source§

impl NurtexConnection

Source

pub async fn new( server_host: impl Into<String>, server_port: u16, ) -> Result<Self>

Метод создания нового подключения

Source

pub async fn new_with_proxy( server_host: impl Into<String>, server_port: u16, proxy: &Proxy, ) -> Result<Self>

Метод создания нового подключения с прокси

Source

pub async fn new_from_stream(stream: TcpStream) -> Result<Self>

Метод создания нового подключения из TcpStream

Source

pub fn get_reader(&self) -> Arc<Mutex<ConnectionReader>>

Метод получения reader

Source

pub fn get_writer(&self) -> Arc<Mutex<ConnectionWriter>>

Метод получения writer

Source

pub async fn get_state(&self) -> ConnectionState

Метод получения текущего состояния подключения

Source

pub async fn set_state(&self, state: ConnectionState)

Метод изменения состояния подключения

Source

pub async fn read_packet(&self) -> Option<ClientsidePacket>

Вспомогательный метод чтения пакета

Source

pub async fn read_status_packet(&self) -> Option<ClientsideStatusPacket>

Вспомогательный метод чтения status пакета

Source

pub async fn read_login_packet(&self) -> Option<ClientsideLoginPacket>

Вспомогательный метод чтения login пакета

Source

pub async fn read_configuration_packet( &self, ) -> Option<ClientsideConfigurationPacket>

Вспомогательный метод чтения configuration пакета

Source

pub async fn read_play_packet(&self) -> Option<ClientsidePlayPacket>

Вспомогательный метод чтения play пакета

Source

pub async fn write_packet(&self, packet: ServersidePacket) -> Result<()>

Вспомогательный метод записи пакета

Source

pub async fn write_handshake_packet( &self, packet: ServersideHandshakePacket, ) -> Result<()>

Вспомогательный метод записи handshake пакета

Source

pub async fn write_status_packet( &self, packet: ServersideStatusPacket, ) -> Result<()>

Вспомогательный метод записи status пакета

Source

pub async fn write_login_packet( &self, packet: ServersideLoginPacket, ) -> Result<()>

Вспомогательный метод записи login пакета

Source

pub async fn write_configuration_packet( &self, packet: ServersideConfigurationPacket, ) -> Result<()>

Вспомогательный метод записи configuration пакета

Source

pub async fn write_play_packet( &self, packet: ServersidePlayPacket, ) -> Result<()>

Вспомогательный метод записи play пакета

Source

pub async fn shutdown(&self) -> Result<()>

Метод выключения соединения

Source

pub async fn set_compression_threshold(&self, threshold: i32)

Метод установки порога сжатия

Source

pub async fn set_encryption_key(&self, secret_key: [u8; 16])

Устанавливает шифрование на соединении используя секретный ключ. Этот метод должен быть вызван после отправки EncryptionResponse серверу

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V