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

A Semigroup is a class of thing that has a definable combine operation

Required Methods§

source

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

Associative operation taking which combines two values.

Examples
use frunk::Semigroup;

assert_eq!(Some(1).combine(&Some(2)), Some(3))
Run

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Semigroup for f32

source§

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

source§

impl Semigroup for f64

source§

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

source§

impl Semigroup for i8

source§

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

source§

impl Semigroup for i16

source§

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

source§

impl Semigroup for i32

source§

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

source§

impl Semigroup for i64

source§

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

source§

impl Semigroup for isize

source§

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

source§

impl Semigroup for u8

source§

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

source§

impl Semigroup for u16

source§

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

source§

impl Semigroup for u32

source§

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

source§

impl Semigroup for u64

source§

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

source§

impl Semigroup for usize

source§

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

source§

impl Semigroup for String

source§

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

source§

impl<A: Semigroup> Semigroup for (A,)

source§

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

source§

impl<A: Semigroup, B: Semigroup> Semigroup for (A, B)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup> Semigroup for (A, B, C)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup> Semigroup for (A, B, C, D)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup> Semigroup for (A, B, C, D, E)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup> Semigroup for (A, B, C, D, E, F)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup> Semigroup for (A, B, C, D, E, F, G)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup> Semigroup for (A, B, C, D, E, F, G, H)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup, J: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I, J)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup, J: Semigroup, K: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I, J, K)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup, J: Semigroup, K: Semigroup, L: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I, J, K, L)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup, J: Semigroup, K: Semigroup, L: Semigroup, M: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I, J, K, L, M)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup, J: Semigroup, K: Semigroup, L: Semigroup, M: Semigroup, N: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I, J, K, L, M, N)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup, J: Semigroup, K: Semigroup, L: Semigroup, M: Semigroup, N: Semigroup, O: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup, J: Semigroup, K: Semigroup, L: Semigroup, M: Semigroup, N: Semigroup, O: Semigroup, P: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup, J: Semigroup, K: Semigroup, L: Semigroup, M: Semigroup, N: Semigroup, O: Semigroup, P: Semigroup, Q: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup, J: Semigroup, K: Semigroup, L: Semigroup, M: Semigroup, N: Semigroup, O: Semigroup, P: Semigroup, Q: Semigroup, R: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup, J: Semigroup, K: Semigroup, L: Semigroup, M: Semigroup, N: Semigroup, O: Semigroup, P: Semigroup, Q: Semigroup, R: Semigroup, S: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup, J: Semigroup, K: Semigroup, L: Semigroup, M: Semigroup, N: Semigroup, O: Semigroup, P: Semigroup, Q: Semigroup, R: Semigroup, S: Semigroup, T: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)

source§

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

source§

impl<A: Semigroup, B: Semigroup, C: Semigroup, D: Semigroup, E: Semigroup, F: Semigroup, G: Semigroup, H: Semigroup, I: Semigroup, J: Semigroup, K: Semigroup, L: Semigroup, M: Semigroup, N: Semigroup, O: Semigroup, P: Semigroup, Q: Semigroup, R: Semigroup, S: Semigroup, T: Semigroup, U: Semigroup> Semigroup for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)

source§

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

source§

impl<K, V> Semigroup for HashMap<K, V>
where K: Eq + Hash + Clone, V: Semigroup + Clone,

source§

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

source§

impl<T> Semigroup for Option<T>
where T: Semigroup + Clone,

source§

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

source§

impl<T> Semigroup for Cell<T>
where T: Semigroup + Copy,

source§

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

source§

impl<T> Semigroup for HashSet<T>
where T: Eq + Hash + Clone,

source§

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

source§

impl<T: Clone> Semigroup for Vec<T>

source§

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

source§

impl<T: Semigroup> Semigroup for Box<T>

source§

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

source§

impl<T: Semigroup> Semigroup for RefCell<T>

source§

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

Implementors§

source§

impl Semigroup for HNil

Since () + () = (), the same is true for HNil

source§

impl Semigroup for All<bool>

source§

impl Semigroup for All<i8>

source§

impl Semigroup for All<i16>

source§

impl Semigroup for All<i32>

source§

impl Semigroup for All<i64>

source§

impl Semigroup for All<isize>

source§

impl Semigroup for All<u8>

source§

impl Semigroup for All<u16>

source§

impl Semigroup for All<u32>

source§

impl Semigroup for All<u64>

source§

impl Semigroup for All<usize>

source§

impl Semigroup for Any<bool>

source§

impl Semigroup for Any<i8>

source§

impl Semigroup for Any<i16>

source§

impl Semigroup for Any<i32>

source§

impl Semigroup for Any<i64>

source§

impl Semigroup for Any<isize>

source§

impl Semigroup for Any<u8>

source§

impl Semigroup for Any<u16>

source§

impl Semigroup for Any<u32>

source§

impl Semigroup for Any<u64>

source§

impl Semigroup for Any<usize>

source§

impl Semigroup for Product<f32>

source§

impl Semigroup for Product<f64>

source§

impl Semigroup for Product<i8>

source§

impl Semigroup for Product<i16>

source§

impl Semigroup for Product<i32>

source§

impl Semigroup for Product<i64>

source§

impl Semigroup for Product<isize>

source§

impl Semigroup for Product<u8>

source§

impl Semigroup for Product<u16>

source§

impl Semigroup for Product<u32>

source§

impl Semigroup for Product<u64>

source§

impl Semigroup for Product<usize>

source§

impl<H: Semigroup, T: HList + Semigroup> Semigroup for HCons<H, T>

Allow the combination of any two HLists having the same structure if all of the sub-element types are also Semiups

source§

impl<T> Semigroup for Max<T>
where T: Ord + Clone,

source§

impl<T> Semigroup for Min<T>
where T: Ord + Clone,