thomasarmel / socket-server-mocker

Mock socket server in Rust, for testing various network clients.
https://crates.io/crates/socket-server-mocker
MIT License
0 stars 2 forks source link

Rework API to use just one struct #18

Open nyurik opened 3 days ago

nyurik commented 3 days ago

Fixes #17

// protocol-specific functions
ServerMocker::tcp()
ServerMocker::tcp_with_port(port)
ServerMocker::udp()
ServerMocker::udp_with_port(port)
// generic function taking anything that
// implements the needed (non-public) trait
ServerMocker::new_with_opts(options_object)
nyurik commented 2 days ago

One big question I keep having is the better naming... Note that even Clippy complains about the repeated name (you have this lint disabled)... And since renaming crate is not that convenient, some ideas here:

There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors.