pub struct Vis { /* private fields */ }Expand description
In-memory VIS graph.
Implementations§
Source§impl Vis
impl Vis
Sourcepub fn visibility(&self) -> &BTreeMap<String, BTreeSet<String>>
pub fn visibility(&self) -> &BTreeMap<String, BTreeSet<String>>
Returns visibility edges keyed by observer room.
Sourcepub fn room_exists(&self, room: &str) -> bool
pub fn room_exists(&self, room: &str) -> bool
Returns true if room exists in the graph.
Sourcepub fn remove_room(&mut self, room: &str)
pub fn remove_room(&mut self, room: &str)
Removes a room and all references to it.
Sourcepub fn rename_room(&mut self, old: &str, new: &str) -> Result<(), VisError>
pub fn rename_room(&mut self, old: &str, new: &str) -> Result<(), VisError>
Renames a room and updates all references to it.
§Errors
VisError::MissingRoom when old names no room, carrying the name.
Nothing is renamed in that case. new is not checked for whitespace,
which the grammar cannot represent; the writer refuses that instead.
Sourcepub fn set_visible(
&mut self,
when_inside: &str,
show: &str,
visible: bool,
) -> Result<(), VisError>
pub fn set_visible( &mut self, when_inside: &str, show: &str, visible: bool, ) -> Result<(), VisError>
Sets visibility between two rooms.
§Errors
VisError::MissingRoom when either name is not a room in the graph,
carrying the one that is missing. Visibility is directional, so both
have to exist and only the named direction changes.
Sourcepub fn get_visible(
&self,
when_inside: &str,
show: &str,
) -> Result<bool, VisError>
pub fn get_visible( &self, when_inside: &str, show: &str, ) -> Result<bool, VisError>
Returns whether one room is visible from another.
§Errors
VisError::MissingRoom when when_inside names no room. A show
that is not visible from it is Ok(false) rather than an error, so
this distinguishes “not visible” from “not a room”.
Sourcepub fn set_all_visible(&mut self)
pub fn set_all_visible(&mut self)
Marks all rooms visible from each other (excluding self-visibility).