Skip to main content
Glama
lib.rs2.22 kB
//! Derive macros that help reduce the amount of boilerplate when crafting API types using the //! `acceptable` crate. #![warn( bad_style, clippy::missing_panics_doc, clippy::panic, clippy::panic_in_result_fn, clippy::unwrap_in_result, clippy::unwrap_used, dead_code, improper_ctypes, missing_debug_implementations, missing_docs, no_mangle_generic_items, non_shorthand_field_patterns, overflowing_literals, path_statements, patterns_in_fns_without_body, unconditional_recursion, unreachable_pub, unused, unused_allocation, unused_comparisons, unused_parens, while_true )] #[allow(unused_extern_crates)] extern crate proc_macro; use manyhow::{ Emitter, manyhow, }; use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; mod all_versions; mod container; mod current_container; mod versioned; /// Derives the `AllVersions` trait, marking a type as a container over all possible versions of a /// message type. #[manyhow] #[proc_macro_derive(AllVersions, attributes(acceptable))] pub fn derive_all_versions( input: TokenStream, errors: &mut Emitter, ) -> manyhow::Result<TokenStream2> { crate::all_versions::expand(input, errors) } /// Dervies the `Container` trait on a type which encloses a current version of a message type. #[manyhow] #[proc_macro_derive(Container, attributes(acceptable))] pub fn derive_container(input: TokenStream, errors: &mut Emitter) -> manyhow::Result<TokenStream2> { crate::container::expand(input, errors) } /// Derives a `Container` implemented type associated with the current `AllVersions`-implemented /// type. #[manyhow] #[proc_macro_derive(CurrentContainer, attributes(acceptable))] pub fn derive_current_container( input: TokenStream, errors: &mut Emitter, ) -> manyhow::Result<TokenStream2> { crate::current_container::expand(input, errors) } /// Derives the `Versioned` trait for a unique version of a message type. #[manyhow] #[proc_macro_derive(Versioned, attributes(acceptable))] pub fn derive_versioned(input: TokenStream, errors: &mut Emitter) -> manyhow::Result<TokenStream2> { crate::versioned::expand(input, errors) }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/systeminit/si'

If you have feedback or need assistance with the MCP directory API, please join our Discord server