websockets-rs / rust-websocket

A WebSocket (RFC6455) library written in Rust
http://websockets-rs.github.io/rust-websocket/
MIT License
1.55k stars 223 forks source link

Imports doesn't work on edition=2018 #202

Closed kper closed 5 years ago

kper commented 5 years ago

The async-server example cannot compile with editon 2018 because it has async in path.

Code: use websocket::async::Server;

Error:

error: expected identifier, found reserved keyword `async`                                           
  --> src/main.rs:16:16                                                                              
   |                                                                                                 
16 | use websocket::async::Server;                                                                   
   |                ^^^^^ expected identifier, found reserved keyword    
vi commented 5 years ago

r#async?

kper commented 5 years ago

Works thanks :)

vpzomtrrfrt commented 5 years ago

While the r# syntax does work, that doesn't really seem like a solution

vi commented 5 years ago

What do you suggest instead?

Migration to new hyper 0.12 may be a rather breaking change, so it may be a good point to rename async to something else.

vi commented 5 years ago

While the r# syntax does work, that doesn't really seem like a solution

Depending on acceptance of usage of r#raw r#identifier syntax for things other than compatibility.

let fk = 0.5;
let fm = 0.1;
let r#fn = (fk + fm)/2.0;
let Fn = 1.0 / r#fn;

let micro = 0.02;
let r#macro = 200;

let price_per_unit = 500;
let r#yield = 10;
let storage_cost=20;

If such identifiers are not treated as "second class citizens", it may make sense to expose then in some new APIs (if naming precision advantage offsets the cost of r#).