Struct elytra_ping::protocol::SlpProtocol
source · pub struct SlpProtocol { /* private fields */ }Implementations§
source§impl SlpProtocol
impl SlpProtocol
pub fn new(hostname: String, port: u16, stream: TcpStream) -> Self
pub fn create_handshake_frame(&self) -> Frame
sourcepub async fn write_frame(&mut self, frame: Frame) -> Result<(), ProtocolError>
pub async fn write_frame(&mut self, frame: Frame) -> Result<(), ProtocolError>
Sends frame data over the connection as a packet.
sourcepub async fn read_frame(
&mut self,
server_state: Option<ServerState>
) -> Result<Option<Frame>, ProtocolError>
pub async fn read_frame( &mut self, server_state: Option<ServerState> ) -> Result<Option<Frame>, ProtocolError>
Recieve and parse a frame from the connection.
Arguments
server_state- Switches between which type of frame to accept. Set to None to accept frames for the client.
sourcepub fn parse_frame(
&mut self,
server_state: Option<ServerState>
) -> Result<Option<Frame>, ProtocolError>
pub fn parse_frame( &mut self, server_state: Option<ServerState> ) -> Result<Option<Frame>, ProtocolError>
Parse the most recent frame from the connection, removing it from the buffer.
Arguments
server_state- Switches between which type of frame to accept. Set to None to accept frames for the client.
pub async fn disconnect(self) -> Result<(), ProtocolError>
pub async fn handshake(&mut self) -> Result<(), ProtocolError>
pub async fn get_status(&mut self) -> Result<JavaServerInfo, PingError>
pub async fn get_latency(&mut self) -> Result<Duration, PingError>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for SlpProtocol
impl Send for SlpProtocol
impl Sync for SlpProtocol
impl Unpin for SlpProtocol
impl UnwindSafe for SlpProtocol
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