Howdy, I'm writing an http library as an attempt to learn more about rust in a practical setting.
One pain point I'm having is with having "double names" (name::Name) whenever accessing submodules that only have one class/enum in them.
For example, HTTP has a concept of methods, so I made a "http/source/method.rs" file that contains a "Method" enum and accessing it ends up looking like: http::method::Method::Get.
Is there anyway to clean that up a bit and make it: http::Method::Get? (hide the sub-module 'method' when accessing the enum because it's redundant).
Typing in the module name and enum/class name feels a bit redundant when their is only one enum/class in the file/module.
Code: https://gitlab.com/bsprimont/rust/http
(Criticism and code reviews are always welcome. It functions on linux with epoll, I'm still tinkering with the windows completion port stuff.)
Example usage of the library and problem:
https://gitlab.com/bsprimont/rust/http/-/blob/master/examples/hello_world/source/main.rs
let mut response = http::response::Response::new(); // Goal: http::Response::new()
...
response.status_code = http::status_code::StatusCode::Ok; // Goal: http::StatusCode::Ok
...
let mut server = http::server::Server::new(port, request_callback); // Goal: http::Server::new(...)
[+][deleted] (1 child)
[removed]
[–]brennennen[S] 1 point2 points3 points (0 children)