SHARE
TWEET

Untitled

a guest Oct 10th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. macro_rules! ngettext {
  2.  ($singular:expr, ( $($singular_names:ident = $singular_values:expr),* ), $plural:expr, ( $($plural_names:ident = $plural_values:expr),* ), $n:expr) =>
  3.  ((format!($singular, $( $singular_names = $singular_values ),*), format!($plural, $( $plural_names = $plural_values ),*), $n));
  4. }
  5.  
  6. fn main() {
  7.     let name = "Alice";
  8.     let names = ["Bob", "Cat"];
  9.     let x = ngettext!(
  10.         "singular {item}",
  11.         (item = name),
  12.         "plural {items:?}",
  13.         (items = names),
  14.         5
  15.     );
  16.  
  17.     println!("{:?}", x)
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top