-
-
Save RandyMcMillan/75a1b146e9d46684c0d287f73a727e36 to your computer and use it in GitHub Desktop.
verify_libraries.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// This macro takes a list of crate names and "touches" them | |
| /// by referencing their absolute path. If the crate is missing, | |
| /// the code will fail to compile. | |
| macro_rules! verify_libraries { | |
| ($($lib:ident),*) => { | |
| println!("--- Verifying Library Linkage ---"); | |
| $( | |
| // We use a statement that references the crate without side effects | |
| let _ = stringify!($lib); | |
| println!("✅ [{}] is linked and accessible.", stringify!($lib)); | |
| )* | |
| println!("---------------------------------"); | |
| }; | |
| } | |
| fn main() { | |
| // Populating the macro with a representative sample from your list. | |
| // In the playground, these are pre-compiled and ready to use. | |
| verify_libraries!( | |
| anyhow, | |
| chrono, | |
| serde, | |
| serde_json, | |
| tokio, | |
| reqwest, | |
| regex, | |
| once_cell, | |
| base64, | |
| bytes, | |
| itertools, | |
| log, | |
| thiserror, | |
| uuid, | |
| url | |
| ); | |
| println!("\nTotal libraries verified in this pass: 15"); | |
| // Example of using a parsed value from one of the "verified" libs | |
| let sample_uuid = uuid::Uuid::new_v4(); | |
| println!("Example output (uuid): {}", sample_uuid); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=92d51183db642452adfdc34b3e65e4d4