Skip to content

Commit

Permalink
Remove cfg_attr and replace with a normal cfg attribute in the doctes…
Browse files Browse the repository at this point in the history
…t itself
  • Loading branch information
JSorngard committed Dec 16, 2023
1 parent ea976f2 commit 4510e6e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions codec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,18 @@
//! assert_eq!(zstr.decoded_chars().next_back(), Some('o'));
//! # Ok::<(), Error>(())
//! ```
//! Encode Rust source code and embed it in your program with the [`zalgo_embed!`] proc-macro:
//! ```
//! # #[cfg(feature = "macro")]
//! # {
//! # use zalgo_codec::zalgo_embed;
//! // This grapheme cluster was made by encoding "add(x: i32, y: i32) -> i32 {x + y}"
//! zalgo_embed!("E͎͉͙͉̞͉͙͆̀́̈́̈́̈̀̓̒̌̀̀̓̒̉̀̍̀̓̒̀͛̀̋̀͘̚̚͘͝");
//!
// This ensures that `cargo test` still works if the macro feature is disabled.
#![cfg_attr(
feature = "macro",
doc = " Encode Rust source code and embed it in your program with the [`zalgo_embed!`] proc-macro:\n ```\n # use zalgo_codec::zalgo_embed;\n // This grapheme cluster was made by encoding \"fn add(x: i32, y: i32) -> i32 {x + y}\"\n zalgo_embed!(\"E͎͉͙͉̞͉͙͆̀́̈́̈́̈̀̓̒̌̀̀̓̒̉̀̍̀̓̒̀͛̀̋̀͘̚̚͘͝\");\n\n // The `add` function is now available\n assert_eq!(add(10, 20), 30);\n ```"
)]
//! // The `add` function is now available
//! assert_eq!(add(10, 20), 30);
//! # }
//! ```
//!
//! # Features
//!
Expand Down

0 comments on commit 4510e6e

Please sign in to comment.