From 093b3d25c95c66890186c3a0effc4aa8171db1a0 Mon Sep 17 00:00:00 2001 From: Louis <836250617@qq.com> Date: Wed, 20 Dec 2023 14:54:51 +0800 Subject: [PATCH] fix: test in README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 48bbb9f..6ecc500 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,8 @@ This crate also has some optional features: ## Usage +_(You may see many `#[cfg(feature = "...")]` in the example below, if you are not familar to Rust, you may not know this attribute is for `Conditinal Compile`, so that I can test it in `cargo test --all-features` automatically to ensure all go right.)_ + You can implement the `Source`, `PersistSource` and `SecretSource` yourself. ```rust no_run use encrypt_config::{Config, SecretSource}; @@ -146,11 +148,13 @@ struct Foo(String); struct SourceFoo; //To derive [`PersistSource`] +#[cfg(not(feature = "default_config_dir"))] #[derive(PersistSource)] #[source(value(Foo), path("tests/persist.conf"), default([("key".to_owned(), Foo("value".to_owned()))]))] struct PersistSourceFoo; // To derive [`SecretSource`] +#[cfg(not(feature = "default_config_dir"))] #[derive(SecretSource)] #[source(value(Foo), path("tests/secret.conf"), default([("key".to_owned(), Foo("value".to_owned()))]))] struct SecretSourceFoo;