pub struct Logical(pub [[bool; 2]; 2]);Expand description
A function of two Booleans, held as its truth table: Logical(t) gives t[r][x] for the running result r and the next item x. Its scans run any such function.
Tuple Fields§
§0: [[bool; 2]; 2]Implementations§
Source§impl Logical
impl Logical
Sourcepub fn scan(self, x: &[bool], start: Option<bool>, out: &mut Vec<bool>)
pub fn scan(self, x: &[bool], start: Option<bool>, out: &mut Vec<bool>)
Appends the running results of x to out: the first item, or start combined with it where start is given, then each result combined with the next item.
For each value of the next item, the function maps the running result to itself, to its negation, or to a constant. Where one value maps it to itself and the other to a constant, as for and and or, the results change at most once. first_where finds that place, and two runs fill the rest. Otherwise each map is r ↦ (s ∧ r) ≠ t for two bits s and t, and the maps compose as r ↦ (s₂ ∧ s₁ ∧ r) ≠ ((s₂ ∧ t₁) ≠ t₂). Each block of 64 items packs into a word of bits, whose maps compose in six steps of shifts, with no branch and no step for each item.
Trait Implementations§
impl Copy for Logical
impl Eq for Logical
impl StructuralPartialEq for Logical
Auto Trait Implementations§
impl Forget for Logical
impl Freeze for Logical
impl RefUnwindSafe for Logical
impl Send for Logical
impl Sync for Logical
impl Unpin for Logical
impl UnsafeUnpin for Logical
impl UnwindSafe for Logical
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more