RadicalZephyr / sodium-rust

FRP implementation in Rust
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Trait bounds on `Stream` types #15

Open RadicalZephyr opened 8 months ago

RadicalZephyr commented 8 months ago

Currently the basic design of Sodium assumes that anything sent through a Stream is Cloneable. In addition, to support a hypothetical multi-threaded processing algorithm, Stream values also need to be 'static + Send + Sync.

This is hefty requirement that some types don't meet, including some types that users are very likely to want to send through Streams such as std::io::Error. This has no Clone impl, which in turn means that an io::Result<T> also has no Clone impl regardless of whether T: Clone. Upon encountering a type like this, the user has two courses of action, either deal with this type outside of the Sodium system (encouraging them to put logic into their imperative shell); or find some way to make this object Clone which basically means wrapping it an Arc.

This is a papercut, and it's probably not completely obvious how to solve this for the new user.