Backend

Nearly all guidelines are documented using rust-clippy, so this document is kept short.

  • Always derive Debug and Clone (but beware of deriving Copy).
  • Actions must be created in backend/src/model/dto/actions.rs.
  • We reuse the global http client like this: let server = HttpServer::new(move || { App::new() /*other initialization code*/ .app_data(http_client.clone()) }).
  • Read also about backend logging.

Serialization

  • In case struct properties of type Option<T> have value None, they should be serialized as missing properties instead of null values.
    This is a workaround for an open typeshare issue.
    Such serialization can be achieved by adding serde skip_serializing_if attribute on such property: #[serde(skip_serializing_if = "Option::is_none")]