Skip to main content

add

Function add 

Source
pub fn add<S: Semiring>(a: S, b: S) -> S
Expand description

Adds two values.

Free function version that dispatches to Semiring::add.

§Type Signature

forall S. Semiring S => (S, S) -> S

§Type Parameters

  • S: The semiring type.

§Parameters

  • a: The first value.
  • b: The second value.

§Returns

The sum of the two values.

§Examples

use fp_library::classes::semiring::add;

assert_eq!(add(2i32, 3), 5);