assert_semigroup

Macro assert_semigroup 

Source
macro_rules! assert_semigroup {
    ($a:expr, $b: expr, $($tail: expr),*) => { ... };
    ($v:expr) => { ... };
}
Expand description

Assert that the given type satisfies the semigroup property.

§Usage

  • 1 argument: iterator of more than 3 items that implements Semigroup.
  • More than 3 arguments: items that implements Semigroup.

§Examples

use semigroup::{assert_semigroup, op::Coalesce};

let a = Coalesce(Some(1));
let b = Coalesce(None);
let c = Coalesce(Some(3));
assert_semigroup!(a, b, c);

let v = vec![a, b, c];
assert_semigroup!(&v);

§Panics

  • If the given function does not satisfy the semigroup property.
  • The input iterator has less than 3 items.
use semigroup::{assert_semigroup, op::Coalesce};
let a = Coalesce(Some(1));
let b = Coalesce(None);
assert_semigroup!(a, b);