You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At present, the only way to construct an Origin or similar directly is through fallible means: parse(). For statically known data, it would be very convenient to have a compile-time checked variant:
impl<'a>Origin<'a>{// When used in a `const` context, fails at compile-time when `path` or// `query` are invalid `Origin` parts.pubconstfnnew(path:&'astr,query:&'astr) -> Origin<'a>{
...}}
We can then provide an origin!() macro that forces a const context:
Alternatively, we can make uri!() smarter so that it allows either Origin or Absolute URIs as the first argument and makes the route part optional. Then, the following would just work:
let _:Absolute<'static> = uri!("http://rocket.rs/foo");let _:Origin<'static> = uri!("/foo/bar");let _:Absolute<'static> = uri!("http://rocket.rs/foo", some_route: a, b, c);let _:Origin<'static> = uri!("/foo/bar", some_route: d, e, f);
At present, the only way to construct an
Origin
or similar directly is through fallible means:parse()
. For statically known data, it would be very convenient to have a compile-time checked variant:We can then provide an
origin!()
macro that forces aconst
context:Alternatively, we can make
uri!()
smarter so that it allows eitherOrigin
orAbsolute
URIs as the first argument and makes theroute
part optional. Then, the following would just work:cc #998
The text was updated successfully, but these errors were encountered: