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>
Receive 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, ProtocolError>
pub async fn get_latency(&mut self) -> Result<Duration, ProtocolError>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SlpProtocol
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