From 94ee888600aaf78ff9f58450498684bac8209047 Mon Sep 17 00:00:00 2001 From: Devin Kelley <105753233+devkelley@users.noreply.github.com> Date: Thu, 4 Jan 2024 03:18:59 -0800 Subject: [PATCH] remove example as it is over complicated --- proc-macros/src/lib.rs | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/proc-macros/src/lib.rs b/proc-macros/src/lib.rs index c84383c..624bc18 100644 --- a/proc-macros/src/lib.rs +++ b/proc-macros/src/lib.rs @@ -13,48 +13,6 @@ use proc_macro::TokenStream; /// /// # Arguments /// * `ts`: A token stream. -/// -/// # Examples -/// -/// Given a Struct: -/// -/// ```rust -/// pub struct CmdOptions { -/// pub endpoint: String, -/// pub log_level: Option, -/// } -/// ``` -/// -/// The `ConfigSource` derive macro will implement `config::Source`: -/// -/// ```rust -/// impl config::Source for CmdOptions { -/// fn clone_into_box(&self) -> Box { -/// Box::new((*self).clone()) -/// } -/// -/// fn collect(&self) -> Result, config::ConfigError> { -/// let mut entries: config::Map::> = config::Map::from([ -/// ( -/// String::from("endpoint"), -/// (&self.endpoint).clone().map(|v| config::Value::from(v)) -/// ), -/// ( -/// String::from("log_level"), -/// Some(config::Value::from((&self.log_level).clone())) -/// ), -/// ]); -/// -/// entries.retain(|_, v| v.is_some()); -/// let entries_w_values = entries.clone(); -/// let valid_entries: config::Map:: = entries_w_values.iter().map(|(k, v)| (k.clone(), v.clone().unwrap())).collect(); -/// -/// Ok(valid_entries.clone()) -/// } -/// } -/// ``` -/// -/// This allows for Structs to be used as a `Source` for configuration through the `config` crate. #[proc_macro_derive(ConfigSource)] pub fn config_source(ts: TokenStream) -> TokenStream { config_source::config_source(ts)