Skip to main content

Rules

Struct Rules 

Source
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

Source

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.

Source

pub fn enabled(self, rule: Rule) -> bool

Whether this rule may fire, which is its own switch and its master’s.

Source

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.

Source

pub fn set(&mut self, rule: Rule, enabled: bool)

Turns one rule on or off.

Source

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.

Source

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.

Source

pub fn named(self, key: &str) -> Option<bool>

What one rule’s setting reads back as, or None when nothing is called that.

Source

pub fn states(self) -> impl Iterator<Item = (&'static str, bool)>

Every rule and its own switch, in report order.

spec/stats/09-measurement.md section 9.7 requires a statistics report to carry the settings state for every rule, which is this.

Source

pub fn changed(self) -> impl Iterator<Item = (&'static str, bool)>

The rules that are not where a fresh database left them, which is what a run records when it says what it measured.

Trait Implementations§

Source§

impl Clone for Rules

Source§

fn clone(&self) -> Rules

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Rules

Source§

impl Debug for Rules

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Rules

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Rules

Source§

impl PartialEq for Rules

Source§

fn eq(&self, other: &Rules) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Rules

Auto Trait Implementations§

§

impl Freeze for Rules

§

impl RefUnwindSafe for Rules

§

impl Send for Rules

§

impl Sync for Rules

§

impl Unpin for Rules

§

impl UnsafeUnpin for Rules

§

impl UnwindSafe for Rules

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.