1#![doc = include_str!("../README.md")]
2#![cfg_attr(test, deny(warnings, unreachable_pub))]
3#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
4
5#[cfg(any(feature = "blocking", feature = "tokio"))]
6use std::net::SocketAddr;
7
8#[macro_use]
9mod macros;
10
11#[cfg(any(feature = "blocking", feature = "tokio"))]
12pub mod address;
13#[cfg(any(feature = "blocking", feature = "tokio"))]
14pub mod builder;
15#[doc(hidden)]
16pub mod error;
17pub mod identifiers;
18pub mod insim;
19pub mod net;
20pub mod packet;
21#[doc(hidden)]
22pub mod result;
23
24pub const VERSION: u8 = 9;
26
27pub(crate) const MAX_SIZE_PACKET: usize = (u8::MAX as usize) * 4;
30
31pub(crate) const DEFAULT_BUFFER_CAPACITY: usize = MAX_SIZE_PACKET * 6;
32
33pub use error::Error;
34pub use insim_core as core;
36pub use packet::{Packet, WithRequestId};
37pub use result::Result;
38
39#[cfg(any(feature = "blocking", feature = "tokio"))]
54pub fn tcp<R: Into<address::Addr>>(remote_addr: R) -> builder::Builder {
55 builder::Builder::default().tcp(remote_addr)
56}
57
58#[cfg(any(feature = "blocking", feature = "tokio"))]
74pub fn udp<L: Into<Option<SocketAddr>>, R: Into<address::Addr>>(
75 remote_addr: R,
76 local_addr: L,
77) -> builder::Builder {
78 builder::Builder::default().udp(remote_addr, local_addr)
79}