Struct cold_iron::detect::Ward [−]
pub struct Ward { /* fields omitted */ }
Expand description
Ward represents a watcher for some entity. It must be assigned to a network address or location
Implementations
impl Ward
impl Ward
pub fn new(thaum: impl Thaumatic) -> Result<Ward, ThaumError>
pub fn new(thaum: impl Thaumatic) -> Result<Ward, ThaumError>
Initialise a thaumatic device as a ward
pub fn watch_network(&mut self, network: &IpCidr) -> Result<(), ThaumError>
pub fn watch_network(&mut self, network: &IpCidr) -> Result<(), ThaumError>
Direct this ward to watch a given network block. The computer the application is running on does not necessarily need to have access to it, but the programmer or executor must be in some way authorised.
pub fn watch_home(&mut self) -> Result<(), ThaumError>
pub fn watch_home(&mut self) -> Result<(), ThaumError>
Direct this ward to watch your “home,” whatever that means to you. CAUTION: home might turn out to mean something quite different than you expect! If you do not have a strong sense of place, consider using an address instead.
pub fn watch_place(&mut self, address: &str) -> Result<(), ThaumError>
pub fn watch_place(&mut self, address: &str) -> Result<(), ThaumError>
Direct this ward to watch a place. Address need not be a literal address: it could be “the big house by the oak tree” or “the fort I built as a child.” The stronger your connection, the more likely success is. Standard disclaimers about real names and addresses applies.
pub fn event_stream(&mut self) -> impl Stream<Item = MalevolentEntity>
pub fn event_stream(&mut self) -> impl Stream<Item = MalevolentEntity>
By default, a broken warding will trigger a sense of unease or fair, depending on your connection to the place warded. For a more concrete list of transgressors, consume the event stream.