pub enum Scope {
City,
Building(Address),
Workshop(Address),
}Expand description
What a halt, a release or an autonomy change applies to.
The wire form is what the histories already hold: city,
building:<addr>, workshop:<addr>. The three words are here, the
parse is here, and both ends of the ledger call this type, so a scope
cannot be written one way and read another.
A word this build does not know is refused rather than read as some other scope: a city that read an unknown scope as its own would report itself shut, and one that read it as nothing would dispatch into a scope a person stopped.
Variants§
City
Everything this city holds.
Building(Address)
One building and what is inside it.
Workshop(Address)
One workshop and what is inside it.
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn covers(&self, addr: &Address) -> bool
pub fn covers(&self, addr: &Address) -> bool
Whether a standing decision on this scope reaches an address.
The city reaches everything; a building and a workshop reach
what is within them, by the containment Address::is_within
already decides, so “inside” means one thing in this city.
Sourcepub fn parse(raw: &str) -> Result<Scope, AxError>
pub fn parse(raw: &str) -> Result<Scope, AxError>
Reads back what fmt::Display wrote.
§Errors
E_WIRE_MISMATCH for a word that names none of the three
shapes, and whatever Address::parse says about an address
this city cannot hold.