ops_mel/
char.rs

1use melodium_core::*;
2use melodium_macro::{check, mel_function, mel_treatment};
3
4/// Return whether `a` is equal to `b`
5#[mel_function]
6pub fn equal(a: char, b: char) -> bool {
7    a == b
8}
9
10/// Return whether `a` is different `b`
11#[mel_function]
12pub fn not_equal(a: char, b: char) -> bool {
13    a != b
14}
15
16/// Determine whether `a` is equal to `b`
17#[mel_treatment(
18    input a Stream<char>
19    input b Stream<char>
20    output result Stream<bool>
21)]
22pub async fn equal() {
23    while let (Ok(a), Ok(b)) = (a.recv_one_char().await, b.recv_one_char().await) {
24        check!(result.send_one_bool(a == b).await)
25    }
26}
27
28/// Determine whether `a` is different from `b`
29#[mel_treatment(
30    input a Stream<char>
31    input b Stream<char>
32    output result Stream<bool>
33)]
34pub async fn not_equal() {
35    while let (Ok(a), Ok(b)) = (a.recv_one_char().await, b.recv_one_char().await) {
36        check!(result.send_one_bool(a != b).await)
37    }
38}