1use melodium_core::*;
2use melodium_macro::{check, mel_function, mel_treatment};
3
4#[mel_treatment(
6 input value Stream<string>
7 output iter Stream<void>
8)]
9pub async fn to_void() {
10 while let Ok(values) = value.recv_string().await {
11 check!(iter.send_void(vec![(); values.len()]).await)
12 }
13}
14
15#[mel_function]
19pub fn to_byte(value: string) -> Vec<byte> {
20 value.as_bytes().to_vec()
21}
22
23#[mel_treatment(
29 input value Stream<string>
30 output data Stream<Vec<byte>>
31)]
32pub async fn to_byte() {
33 while let Ok(values) = value.recv_string().await {
34 check!(
35 data.send_vec_byte(
36 values
37 .into_iter()
38 .map(|val| val.as_bytes().to_vec())
39 .collect()
40 )
41 .await
42 )
43 }
44}