Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

CAN Frame: `is_remote_frame()` and `new_remote()`

Aperta
#740 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
rust
Ambito
embedded-iot

Direzione di ricerca

Search the repository for is_remote_frame() and new_remote() and inspect the CAN Frame implementation and their call sites. Rename the methods to is_request_frame() and new_request(), update references and documentation, then run the relevant Rust tests and checks to confirm the old names are gone.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The CAN Frame method is_remote_frame() returns:

  • true if the frame is a Remote Transmission Request (RTR bit is set)
  • false if the frame is a Data Frame (RTR bit is clear)

In other words, it allows to distinguish between:

  • a frame which contains actual data, and
  • a frame which contains no data, but requests that data be sent back

Calling the latter a "remote frame" is terribly misleading:

  1. It's no more "remote" than a data frame: both come from another device on the bus
  2. It does not convey that it contains no data, nor that it wants data to be sent back
  3. it's not the exclusive opposite to its boolean alternative (the opposite of "remote" is "local" ―not "data", and the opposite of "data" is "no data" ―not "remote"), leading to confusing code like this:
    /// Returns true if this frame is a data frame.
    fn is_data_frame(&self) -> bool {
        !self.is_remote_frame()
    }
  1. Lastly, in device testing mode (we receive the frames we send), it's not even "remote" anymore! Now this unfortunate name has lost any and all connection to whatever meaning it was trying to convey to begin with…

If one wants to shorten "Remote Transmission Request", the only important word in there is: request. Therefore, I'm suggesting that:

  • is_remote_frame() be renamed into is_request_frame()
  • new_remote() be renamed into new_request()

This way, it makes it clear that we're in a "transactional" context, where each frame is either a request or a reply/broadcast:

    /// Returns true if this frame is a data frame.
    fn is_data_frame(&self) -> bool {
        !self.is_request_frame()
    }

Thank you!

Lingua principale
Rust
Stelle
2.7k
Fork
283
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-embedded/embedded-hal

Tutte le issue di rust-embedded/embedded-hal

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.