pub struct Magma<'a, T> { /* private fields */ }
Expand description
A set with an associated binary operation.
This is a representation of the simplest algebraic structure: the magma.
There are no specific properties required of its components, so its
construction involves nothing more than a set (specifically an
AlgaeSet
and a binary operation (anything implementing
BinaryOperation
).
§Examples
use algae_rs::algaeset::AlgaeSet;
use algae_rs::mapping::{BinaryOperation, AbelianOperation};
use algae_rs::magma::{Magmoid, Magma};
let mut add = AbelianOperation::new(&|a, b| a + b);
let mut magma = Magma::new(
AlgaeSet::<i32>::all(),
&mut add
);
let magma_sum = magma.with(1, 2);
assert!(magma_sum.is_ok());
assert!(magma_sum.unwrap() == 3);
Implementations§
Trait Implementations§
Source§impl<'a, T> From<Quasigroup<'a, T>> for Magma<'a, T>
impl<'a, T> From<Quasigroup<'a, T>> for Magma<'a, T>
Source§fn from(quasi: Quasigroup<'a, T>) -> Magma<'a, T>
fn from(quasi: Quasigroup<'a, T>) -> Magma<'a, T>
Converts to this type from the input type.
Source§impl<'a, T> From<UnitalMagma<'a, T>> for Magma<'a, T>
impl<'a, T> From<UnitalMagma<'a, T>> for Magma<'a, T>
Source§fn from(magma: UnitalMagma<'a, T>) -> Magma<'a, T>
fn from(magma: UnitalMagma<'a, T>) -> Magma<'a, T>
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a, T> Freeze for Magma<'a, T>
impl<'a, T> !RefUnwindSafe for Magma<'a, T>
impl<'a, T> !Send for Magma<'a, T>
impl<'a, T> !Sync for Magma<'a, T>
impl<'a, T> Unpin for Magma<'a, T>
impl<'a, T> !UnwindSafe for Magma<'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