Crate bronzite_macros

Crate bronzite_macros 

Source
Expand description

Proc-macros for compile-time type reflection using Bronzite.

This crate provides proc-macros that query type information from a running Bronzite daemon. The daemon is automatically started if not already running.

§Usage

ⓘ
// Get trait implementations as a const array of trait names
const IMPLS: &[&str] = bronzite_trait_names!("my_crate", "MyStruct");

§Note for Proc-Macro Authors

If you’re writing a proc-macro and want to query Bronzite programmatically, use the bronzite-client crate directly instead of this one:

ⓘ
use bronzite_client::{connect_or_start, BronziteClient};

let mut client = connect_or_start(None)?;
let impls = client.get_trait_impls("my_crate", "MyType")?;

Macros§

bronzite_crate_traits
Get all trait names defined in a crate as a const slice.
bronzite_field_names
Get field names of a struct as a const slice.
bronzite_implementors
Get types that implement a trait as a const slice of type path strings.
bronzite_implements
Check if a type implements a trait at compile time.
bronzite_method_names
Get method names from a type’s inherent impl as a const slice.
bronzite_resolve_alias
Resolve a type alias and get the underlying type as a string literal.
bronzite_trait_names
Get the names of all traits implemented by a type as a const slice.