Skip to main content

max

Function max 

Source
pub fn max<A, B, T>(a: A, b: B) -> Map<Zip<A, B>, fn((T, T)) -> T, T>
where A: Signal<Output = T>, B: Signal<Output = T>, T: Ord + Clone + 'static,
Expand description

Returns the maximum value between two Signal values.

This function takes two values implementing the Signal trait with the same output type and returns a new computation that, when executed, will produce the maximum of the outputs from the two input computations.

§Type Parameters

  • A: The first computation type that implements Signal<Output = T>.
  • B: The second computation type that implements Signal<Output = T>.
  • T: The output type that must implement Ord for comparison.

§Constraints

  • Both A and B must have the same output type T.
  • T must implement Ord to enable comparison operations.
  • T must be 'static for lifetime requirements.

§Returns

A new computation that will yield the maximum value between the outputs from computations a and b.

§Examples

let a: Binding<i32> = binding(10);
let b: Binding<i32> = binding(5);
let maximum = max(a, b);
assert_eq!(maximum.snapshot(), 10);