pub struct Rules(/* private fields */);Expand description
Which switches are on, as the statements have left them.
A bitset rather than a map, because there are ten of them, because a session copies this once per statement, and because the set is fixed at compile time.
Implementations§
Source§impl Rules
impl Rules
Sourcepub const fn new() -> Self
pub const fn new() -> Self
What a fresh database has, which is every statistics rule on and the graph sections off.
The statistics rules are on because their whole point is that they change no answer, so a database that had to be told to use them would be a database where nobody used them. The graph sections are off because they are a stored structure that nothing writes yet and a new path through the executor when they arrive, and a new path is worth having on by default only once the measurement says it is better. G3 in tamnd/rudb#763 is where that is decided.
Sourcepub fn enabled(self, rule: Rule) -> bool
pub fn enabled(self, rule: Rule) -> bool
Whether this rule may fire, which is its own switch and its master’s.
Sourcepub fn is_set(self, rule: Rule) -> bool
pub fn is_set(self, rule: Rule) -> bool
Whether this rule’s own switch is on, ignoring its master.
What a setting reads back as, because a settings surface that does not round trip is a
settings surface somebody reports as a bug. Rules::enabled is what is in effect.
Sourcepub fn set_named(&mut self, key: &str, enabled: bool) -> Result<()>
pub fn set_named(&mut self, key: &str, enabled: bool) -> Result<()>
Turns one rule on or off by name.
§Errors
ErrorCode::Catalog when nothing is called that, with the list
of rules in the message.
Sourcepub fn reset_named(&mut self, key: &str) -> Result<()>
pub fn reset_named(&mut self, key: &str) -> Result<()>
Puts one rule back where a fresh database has it, which is what RESET means.
Not the same as setting it on, because Rule::GraphSections starts off and a reset that
turned it on would be a reset that left the database somewhere it has never been.
§Errors
ErrorCode::Catalog when nothing is called that, with the list
of rules in the message.
Sourcepub fn named(self, key: &str) -> Option<bool>
pub fn named(self, key: &str) -> Option<bool>
What one rule’s setting reads back as, or None when nothing is called that.