#![doc(html_root_url = "https://docs.rs/wow_login_messages/0.2.0")]
#![forbid(unsafe_code)]
#![deny(
clippy::complexity,
clippy::correctness,
clippy::perf,
clippy::missing_panics_doc,
clippy::style,
clippy::missing_const_for_fn,
clippy::doc_markdown,
clippy::unseparated_literal_suffix
)]
#![allow(
non_camel_case_types,
non_snake_case,
clippy::missing_errors_doc,
clippy::upper_case_acronyms,
clippy::missing_const_for_fn,
clippy::clone_on_copy
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(docsrs, feature(doc_cfg))]
use std::future::Future;
use std::pin::Pin;
#[cfg(feature = "tokio")]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
#[cfg(feature = "async-std")]
use async_std::io::{ReadExt, WriteExt};
pub mod errors;
pub mod helper;
#[allow(unused, clippy::complexity)]
pub(crate) mod logon;
#[allow(unused)]
pub(crate) mod util;
pub use logon::*;
pub const DEFAULT_PORT: u16 = 3724;
pub trait ServerMessage: Sized {
#[doc(hidden)]
const OPCODE: u8;
#[doc(hidden)]
fn read<R: std::io::Read>(r: &mut R) -> Result<Self, crate::errors::ParseError>;
#[cfg(feature = "sync")]
fn write<W: std::io::Write>(&self, w: &mut W) -> Result<(), std::io::Error>;
#[doc(hidden)]
#[cfg(feature = "async-std")]
fn astd_read<'life0, 'async_trait, R>(
r: &'life0 mut R,
) -> Pin<Box<dyn Future<Output = Result<Self, crate::errors::ParseError>> + Send + 'async_trait>>
where
R: 'async_trait + ReadExt + Unpin + Send,
'life0: 'async_trait,
Self: 'async_trait;
#[cfg(feature = "async-std")]
fn astd_write<'life0, 'life1, 'async_trait, W>(
&'life0 self,
w: &'life1 mut W,
) -> Pin<Box<dyn Future<Output = Result<(), std::io::Error>> + Send + 'async_trait>>
where
W: 'async_trait + WriteExt + Unpin + Send,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
#[doc(hidden)]
#[cfg(feature = "tokio")]
fn tokio_read<'life0, 'async_trait, R>(
r: &'life0 mut R,
) -> Pin<Box<dyn Future<Output = Result<Self, crate::errors::ParseError>> + Send + 'async_trait>>
where
R: 'async_trait + AsyncReadExt + Unpin + Send,
'life0: 'async_trait,
Self: 'async_trait;
#[cfg(feature = "tokio")]
fn tokio_write<'life0, 'life1, 'async_trait, W>(
&'life0 self,
w: &'life1 mut W,
) -> Pin<Box<dyn Future<Output = Result<(), std::io::Error>> + Send + 'async_trait>>
where
W: 'async_trait + AsyncWriteExt + Unpin + Send,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}
pub trait ClientMessage: Sized {
#[doc(hidden)]
const OPCODE: u8;
#[doc(hidden)]
fn read<R: std::io::Read>(r: &mut R) -> Result<Self, crate::errors::ParseError>;
#[cfg(feature = "sync")]
fn write<W: std::io::Write>(&self, w: &mut W) -> Result<(), std::io::Error>;
#[doc(hidden)]
#[cfg(feature = "async-std")]
fn astd_read<'life0, 'async_trait, R>(
r: &'life0 mut R,
) -> Pin<Box<dyn Future<Output = Result<Self, crate::errors::ParseError>> + Send + 'async_trait>>
where
R: 'async_trait + ReadExt + Unpin + Send,
'life0: 'async_trait,
Self: 'async_trait;
#[cfg(feature = "async-std")]
fn astd_write<'life0, 'life1, 'async_trait, W>(
&'life0 self,
w: &'life1 mut W,
) -> Pin<Box<dyn Future<Output = Result<(), std::io::Error>> + Send + 'async_trait>>
where
W: 'async_trait + WriteExt + Unpin + Send,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
#[doc(hidden)]
#[cfg(feature = "tokio")]
fn tokio_read<'life0, 'async_trait, R>(
r: &'life0 mut R,
) -> Pin<Box<dyn Future<Output = Result<Self, crate::errors::ParseError>> + Send + 'async_trait>>
where
R: 'async_trait + AsyncReadExt + Unpin + Send,
'life0: 'async_trait,
Self: 'async_trait;
#[cfg(feature = "tokio")]
fn tokio_write<'life0, 'life1, 'async_trait, W>(
&'life0 self,
w: &'life1 mut W,
) -> Pin<Box<dyn Future<Output = Result<(), std::io::Error>> + Send + 'async_trait>>
where
W: 'async_trait + AsyncWriteExt + Unpin + Send,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}