pub struct Loop<'a, T> { /* private fields */ }
Expand description
A quasigroup with identity
Loop
is a representation of the abstract algebraic loop. Cancellativity
(ie. the Latin Square property) and identity preservation are both required
of its binary operation. Its construction involves a set (specifically an
AlgaeSet
) and a BinaryOperation
with the aforementioned properties.
§Examples
use algae_rs::algaeset::AlgaeSet;
use algae_rs::mapping::{BinaryOperation, LoopOperation};
use algae_rs::magma::{Magmoid, Loop};
let mut add = LoopOperation::new(&|a, b| a + b, 0);
let mut quasigroup = Loop::new(
AlgaeSet::<i32>::all(),
&mut add,
0
);
let sum = quasigroup.with(1, 2);
assert!(sum.is_ok());
assert!(sum.unwrap() == 3);
Implementations§
Trait Implementations§
Source§impl<'a, T: Copy + PartialEq> From<Loop<'a, T>> for Quasigroup<'a, T>
impl<'a, T: Copy + PartialEq> From<Loop<'a, T>> for Quasigroup<'a, T>
Source§fn from(loop_: Loop<'a, T>) -> Quasigroup<'a, T>
fn from(loop_: Loop<'a, T>) -> Quasigroup<'a, T>
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a, T> Freeze for Loop<'a, T>where
T: Freeze,
impl<'a, T> !RefUnwindSafe for Loop<'a, T>
impl<'a, T> !Send for Loop<'a, T>
impl<'a, T> !Sync for Loop<'a, T>
impl<'a, T> Unpin for Loop<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for Loop<'a, T>
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
Mutably borrows from an owned value. Read more