Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created January 25, 2026 18:11
Show Gist options
  • Select an option

  • Save rust-play/92d51183db642452adfdc34b3e65e4d4 to your computer and use it in GitHub Desktop.

Select an option

Save rust-play/92d51183db642452adfdc34b3e65e4d4 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
/// 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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment