| 204 | const AUTH_METADATA_CONST: &str = "AUTH_METADATA"; |
| 205 | |
| 206 | fn trait_ident(item: &ItemImpl) -> Result<Ident> { |
| 207 | let (_, path, _) = item.trait_.as_ref().ok_or_else(|| { |
| 208 | Error::new( |
| 209 | item.span(), |
| 210 | "`#[rpc_authz]` must be applied to a trait impl (`impl Trait for Type`)", |
| 211 | ) |
| 212 | })?; |
| 213 | path.segments |
| 214 | .last() |
| 215 | .map(|seg| seg.ident.clone()) |
| 216 | .ok_or_else(|| Error::new(path.span(), "could not determine trait identifier")) |
| 217 | } |
| 218 | |
| 219 | #[proc_macro_attribute] |
| 220 | pub fn rpc_authz(args: TokenStream, item: TokenStream) -> TokenStream { |