MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / trait_ident

Function trait_ident

crates/openshell-server-macros/src/lib.rs:206–217  ·  view source on GitHub ↗
(item: &ItemImpl)

Source from the content-addressed store, hash-verified

204const AUTH_METADATA_CONST: &str = "AUTH_METADATA";
205
206fn 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]
220pub fn rpc_authz(args: TokenStream, item: TokenStream) -> TokenStream {

Callers 1

expandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected