quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.76k stars 380 forks source link

Trying to implement `Debug` for `IdleTimeout` #1687

Closed vvvviiv closed 11 months ago

vvvviiv commented 11 months ago

Hello, I noticed that the Debug trait isn't implemented for the IdleTimeout struct in quinn-proto/src/config.rs. I'm trying to fix it, but I'm uncertain about the preferred style for debugging messages.

I have come up with two ways to fix it:

  1. Simply use the Debug derive macro.

    #[derive(Default, Debug, Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd)]
    pub struct IdleTimeout(VarInt);
  2. Use the same style as the VarInt struct in quinn-proto/src/varint.rs.

    impl fmt::Debug for IdleTimeout {
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
        self.0.fmt(f)
    }
    }

Or am I missing something that blocks the implementation? Please let me know if there is anything else that needs to be done to implement this.

Ralith commented 11 months ago

Either would be fine; personally I lean towards the latter to reduce noise, but I don't think we need to overthink this.