feat: add ingress score (#32)
Co-authored-by: tahahawa <tahahawa@gmail.com> Reviewed-on: #32 Reviewed-by: wjro <wrolleman@nationtech.io>
This commit is contained in:
@@ -116,3 +116,19 @@ pub fn yaml(input: TokenStream) -> TokenStream {
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Verify that a string is a valid(ish) ingress path
|
||||
/// Panics if path does not start with `/`
|
||||
#[proc_macro]
|
||||
pub fn ingress_path(input: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(input as LitStr);
|
||||
let path_str = input.value();
|
||||
|
||||
match path_str.starts_with("/") {
|
||||
true => {
|
||||
let expanded = quote! {(#path_str.to_string()) };
|
||||
return TokenStream::from(expanded);
|
||||
}
|
||||
false => panic!("Invalid ingress path"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user