Сделай?)
Я имею в виду что-то такого плана:
pub fn new_ipc(
ipc_path: &str,
pg_path: &str,
) -> Result<Pipe<Ipc>, Box<std::error::Error>> {
new_proto::<Ipc>(ipc_path, pg_path)
}
pub fn new_http(
http_path: &str,
pg_path: &str,
) -> Result<Pipe<Http>, Box<std::error::Error>> {
new_proto::<Http>(http_path, pg_path)
}
fn new<Proto>(
proto_path: &str,
pg_path: &str,
) -> Result<Pipe<Proto>, Box<std::error::Error>> {
// …
}