veloren/common/src/lib.rs

67 lines
1.7 KiB
Rust
Raw Normal View History

2019-08-19 12:39:23 +00:00
#![deny(unsafe_code)]
2019-06-27 14:37:33 +00:00
#![type_length_limit = "1664759"]
#![feature(
trait_alias,
option_flattening, // Converts Option<Option<Item>> into Option<Item> TODO: Remove this once this feature becomes stable
)]
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate log;
2019-01-02 17:23:31 +00:00
pub mod assets;
pub mod clock;
2019-01-02 19:22:01 +00:00
pub mod comp;
pub mod effect;
2019-08-07 15:39:16 +00:00
pub mod event;
pub mod figure;
pub mod msg;
pub mod npc;
pub mod ray;
2019-01-02 19:22:01 +00:00
pub mod state;
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;
pub mod volumes;
/// 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.
/// # Examples
/// ```
/// 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));
///
/// let mut server: PostOffice<String, String> = PostOffice::bind(listen_addr).unwrap();
/// let mut client: PostBox<String, String> = PostBox::to(conn_addr).unwrap();
/// std::thread::sleep(std::time::Duration::from_millis(100));
///
/// let mut scon = server.new_postboxes().next().unwrap();
/// std::thread::sleep(std::time::Duration::from_millis(100));
///
/// scon.send_message(String::from("foo"));
/// client.send_message(String::from("bar"));
/// std::thread::sleep(std::time::Duration::from_millis(100));
///
/// assert_eq!("foo", client.next_message().unwrap());
/// assert_eq!("bar", scon.next_message().unwrap());
/// ```
pub mod net;
2019-07-17 22:10:42 +00:00
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ChatType {
Broadcast,
2019-07-17 22:10:42 +00:00
Chat,
GameUpdate,
Private,
2019-07-17 22:10:42 +00:00
Tell,
2019-07-29 14:40:46 +00:00
Say,
Group,
Faction,
Meta,
Kill,
2019-07-17 22:10:42 +00:00
}