Semigroup

Trait Semigroup 

Source
pub trait Semigroup: Clone {
    // Required method
    fn mappend(&self, other: &Self) -> Self;
}
Expand description

Semigroup type class

Required Methods§

Source

fn mappend(&self, other: &Self) -> Self

combine 2 of the same type

§Examples
use funlib::Semigroup;
assert_eq!(4i32, 1i32.mappend(&3i32));
assert_eq!(Some(4i32), Some(1i32).mappend(&Some(3i32)));

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Semigroup for f32

Source§

fn mappend(&self, o: &Self) -> Self

Source§

impl Semigroup for f64

Source§

fn mappend(&self, o: &Self) -> Self

Source§

impl Semigroup for i8

Source§

fn mappend(&self, o: &Self) -> Self

Source§

impl Semigroup for i16

Source§

fn mappend(&self, o: &Self) -> Self

Source§

impl Semigroup for i32

Source§

fn mappend(&self, o: &Self) -> Self

Source§

impl Semigroup for i64

Source§

fn mappend(&self, o: &Self) -> Self

Source§

impl Semigroup for u8

Source§

fn mappend(&self, o: &Self) -> Self

Source§

impl Semigroup for u16

Source§

fn mappend(&self, o: &Self) -> Self

Source§

impl Semigroup for u32

Source§

fn mappend(&self, o: &Self) -> Self

Source§

impl Semigroup for u64

Source§

fn mappend(&self, o: &Self) -> Self

Source§

impl<'a> Semigroup for &'a str

Source§

fn mappend(&self, other: &Self) -> Self

Source§

impl<A: Semigroup> Semigroup for Option<A>

Source§

fn mappend(&self, other: &Self) -> Self

Source§

impl<A: Semigroup> Semigroup for Box<A>

Source§

fn mappend(&self, other: &Self) -> Self

Implementors§