4 ms·
And the way you'd do it with this library is // very complex and powerful API effing_mad::effects! { Read { fn read_to_string(bug:
by lalaithion 4y ago
And the way you'd do it with this library is
// very complex and powerful API
effing_mad::effects! {
Read {
fn read_to_string(bug: &mut String) -> Result<usize>;
}
}
#[effectful(Read)]
fn read_to_string() -> io::Result<String> {
let mut string = String::new();
(yield read_to_string(&mut string))?;
Ok(string)
}
and then to call it, you would do
let handler = handler! {
Read {
read() => reader.read(),
}
};
let action = handle_group(read_to_string(), handler);
let result = run(action);