add some doc comments

master
rasul 5 years ago
parent eb01abb0f0
commit 24357a95f8

@ -9,17 +9,30 @@ use crate::id::Id;
use crate::try_log; use crate::try_log;
use crate::world::{Area, AreaType, Direction, Exit, DIRECTION_LIST}; use crate::world::{Area, AreaType, Direction, Exit, DIRECTION_LIST};
/// A specific location in the world.
#[derive(Debug, Deserialize, Serialize)] #[derive(Debug, Deserialize, Serialize)]
pub struct Room { pub struct Room {
/// Unique identifier
pub id: Id, pub id: Id,
/// Parent zone that the room is in
pub zone: Id, pub zone: Id,
/// Name of the room
pub name: String, pub name: String,
/// Description, each line an entry in a `Vec`
pub description: Vec<String>, pub description: Vec<String>,
/// Whether users in the room should be visible to the parent zone
pub users_visible: bool, pub users_visible: bool,
/// Exits from the room
pub exits: HashMap<Direction, Exit>, pub exits: HashMap<Direction, Exit>,
} }
impl Room { impl Room {
/// Return a list of available exits by the short identifier
pub fn exit_string(&self) -> String { pub fn exit_string(&self) -> String {
if self.exits.is_empty() { if self.exits.is_empty() {
return String::new(); return String::new();

Loading…
Cancel
Save