Since Lobby can't contain a db field, it is impossible to pair a vehicle to it's user through it. The application requirements state that a user & vehicle should be able to use a single websocket connection to execute the pair. This is necessary to implement QR code pairing at the client side.
-
The default() method doesn't support args
impl Default for Lobby {
// default() can't take args
fn default(db: Database) -> Lobby {
Lobby {
db_instance: db,
sessions: Hashmap::new(),
rooms: Hashmap::new()
}
}
}
-
There is no way to make the default() method async in Lobby, or anywhere basically.
impl Default for Lobby {
// this throws an error
async fn default() -> Lobby {
// async code to spin up a new connection to db
Lobby {
db_instnace: <db_object>,
sessions: Hashmap::new(),
rooms: Hashmap::new()
}
}
}
Since
Lobbycan't contain adbfield, it is impossible to pair a vehicle to it's user through it. The application requirements state that a user & vehicle should be able to use a single websocket connection to execute the pair. This is necessary to implement QR code pairing at the client side.The
default()method doesn't support argsThere is no way to make the
default()methodasyncinLobby, or anywhere basically.