frunk::semigroup

Trait Semigroup

Source
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))

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 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,