2019-06-26 10:50:55 +00:00
#![ type_length_limit = " 1652471 " ]
2019-04-29 20:37:19 +00:00
#![ feature(
euclidean_division ,
duration_float ,
trait_alias ,
2019-05-18 16:46:14 +00:00
bind_by_move_pattern_guards ,
option_flattening , // Converts Option<Option<Item>> into Option<Item> TODO: Remove this once this feature becomes stable
2019-04-29 20:37:19 +00:00
) ]
2019-02-19 16:59:50 +00:00
#[ macro_use ]
extern crate serde_derive ;
2019-04-13 01:40:59 +00:00
#[ macro_use ]
extern crate log ;
2019-01-02 17:23:31 +00:00
2019-04-13 01:40:59 +00:00
pub mod assets ;
2019-01-12 15:57:19 +00:00
pub mod clock ;
2019-01-02 19:22:01 +00:00
pub mod comp ;
2019-01-13 20:53:55 +00:00
pub mod figure ;
2019-05-18 16:46:14 +00:00
pub mod inventory ;
2019-03-03 22:02:38 +00:00
pub mod msg ;
2019-06-01 19:49:34 +00:00
pub mod npc ;
2019-04-29 20:37:19 +00:00
pub mod ray ;
2019-01-02 19:22:01 +00:00
pub mod state ;
2019-03-02 03:48:30 +00:00
pub mod sys ;
2019-01-02 19:22:01 +00:00
pub mod terrain ;
2019-01-14 23:13:58 +00:00
pub mod util ;
2019-01-02 19:22:01 +00:00
pub mod vol ;
2019-04-29 20:37:19 +00:00
pub mod volumes ;
2019-04-23 22:48:31 +00:00
2019-05-17 09:22:32 +00:00
/// The networking module containing high-level wrappers of `TcpListener` and `TcpStream` (`PostOffice` and `PostBox` respectively) and data types used by both the server and client.
2019-02-19 16:59:50 +00:00
/// # Examples
2019-05-07 18:59:06 +00:00
/// ```
2019-02-19 16:59:50 +00:00
/// use std::net::SocketAddr;
/// use veloren_common::net::{PostOffice, PostBox};
///
/// let listen_addr = SocketAddr::from(([0, 0, 0, 0], 12345u16));
/// let conn_addr = SocketAddr::from(([127, 0, 0, 1], 12345u16));
///
2019-05-07 18:59:06 +00:00
/// let mut server: PostOffice<String, String> = PostOffice::bind(listen_addr).unwrap();
/// let mut client: PostBox<String, String> = PostBox::to(conn_addr).unwrap();
2019-02-19 16:59:50 +00:00
/// std::thread::sleep(std::time::Duration::from_millis(100));
///
2019-05-07 18:59:06 +00:00
/// let mut scon = server.new_postboxes().next().unwrap();
2019-02-19 16:59:50 +00:00
/// std::thread::sleep(std::time::Duration::from_millis(100));
///
2019-05-07 18:59:06 +00:00
/// scon.send_message(String::from("foo"));
/// client.send_message(String::from("bar"));
2019-02-19 16:59:50 +00:00
/// std::thread::sleep(std::time::Duration::from_millis(100));
///
2019-05-07 18:59:06 +00:00
/// assert_eq!("foo", client.next_message().unwrap());
/// assert_eq!("bar", scon.next_message().unwrap());
2019-02-19 16:59:50 +00:00
/// ```
pub mod net ;