BiagioFesta / wtransport

Async-friendly WebTransport implementation in Rust
Apache License 2.0
470 stars 31 forks source link

Add Debug, Clone, and accessors on `ConnectOptions` #226

Closed aecsocket closed 2 months ago

aecsocket commented 2 months ago

Right now ConnectOptions is effectively opaque, but I want to inspect it after creation so I can log the URL that it connects to. The user of my crate creates and passes their own ConnectOptions, so I'm unable to read the URL before creation.

This PR derives Debug so that it can be debug printed, and adds url and additional_headers read-only accessor fields. It also derives Clone so that I can reuse the options for later.

IMO, these two fields should just be public. I don't see a reason to keep them private since this struct is just a data container. But for consistency with the rest of the API, and to allow extending ConnectOptions in the future without breaking existing code, I've just written accessors for the fields individually.

BiagioFesta commented 2 months ago

Thank you