-
-
Notifications
You must be signed in to change notification settings - Fork 343
Open
Description
Using HTTP verbs / methods that are not defined in this crate has very ugly semantics, e.g.:
Method::from_bytes(b"PROPFIND").expect("PROPFIND is a valid method")This expect adds a lot of noise all over the place, but it also can't be defined as a const. The following in invalid:
const PROPFIND: Method = Method::from_bytes(b"PROPFIND")
.expect("PROPFIND is a valid method")At the same time, these verbs are something that can be validated at build time (rather than runtime). Do you think a macro to create methods would be reasonable? I'm thinking something along the lines of:
method!("PROPFIND");It would simply be replaced by the correct method, but a proc_macro could allow validating that the string is an acceptable verb at build time (hence, avoiding having a Result for an operation that is known to be infallible).
d-k-bo
Metadata
Metadata
Assignees
Labels
No labels