Skip to main content

code

Function code 

Source
pub fn code() -> String
Expand description

Generate a random currency code

Examples found in repository?
examples/business_finance.rs (line 54)
9fn main() {
10    println!("=== Faker-Rust Business & Finance Examples ===\n");
11
12    // Banking
13    println!("🏦 BANKING:");
14    println!("  Bank Name:          {}", bank::name());
15    println!("  SWIFT/BIC:          {}", bank::swift_bic());
16    println!("  IBAN:               {}", bank::iban());
17    println!("  Account Number:     {}", bank::account_number());
18    println!();
19
20    // Credit Cards
21    println!("💳 CREDIT CARDS:");
22    println!("  Card Number:        {}", business::credit_card_number());
23    println!("  Card Type:          {}", business::credit_card_type());
24    println!("  Expiry Date:        {}", business::credit_card_expiry_date());
25    println!();
26
27    // Company
28    println!("🏢 COMPANIES:");
29    println!("  Company Name:       {}", company::name());
30    println!("  Industry:           {}", company::industry());
31    println!("  Suffix:             {}", company::suffix());
32    println!("  Catch Phrase:       {}", company::catch_phrase());
33    println!("  BS:                 {}", company::bs());
34    println!();
35
36    // Industry Segments
37    println!("📊 INDUSTRY SEGMENTS:");
38    println!("  Industry:           {}", industry_segments::industry());
39    println!("  Sector:             {}", industry_segments::sector());
40    println!("  Subsector:          {}", industry_segments::subsector());
41    println!();
42
43    // Commerce
44    println!("🛒 COMMERCE:");
45    println!("  Department:         {}", commerce::department());
46    println!("  Product Name:       {}", commerce::product_name());
47    println!("  Price:              {}", commerce::price(None, None));
48    println!("  Promotion Code:     {}", commerce::promotion_code());
49    println!();
50
51    // Currency
52    println!("💰 CURRENCY:");
53    println!("  Currency Name:      {}", currency::name());
54    println!("  Currency Code:      {}", currency::code());
55    println!("  Currency Symbol:    {}", currency::symbol());
56    println!();
57
58    // Invoice
59    println!("📄 INVOICE:");
60    println!("  Reference:          {}", invoice::reference());
61    println!("  Amount:             {}", invoice::amount());
62    println!("  Line Item:          {}", invoice::line_item());
63    println!();
64
65    // Blockchain & Crypto
66    println!("🔗 BLOCKCHAIN:");
67    println!("  Bitcoin Address:    {}", blockchain::bitcoin::address());
68    println!("  Ethereum Address:   {}", blockchain::ethereum::address());
69    println!("  Tezos Account:      {}", blockchain::tezos::account());
70    println!();
71
72    // Finance
73    println!("� FINANCE:");
74    println!("  Stock Ticker:       {}", finance::stock_ticker());
75    println!("  Market Index:       {}", finance::market_index());
76    println!("  Currency Pair:      {}", finance::currency_pair());
77    println!();
78
79    // Stripe
80    println!("� STRIPE PAYMENTS:");
81    println!("  Plan:               {}", stripe::plan());
82    println!("  Product:            {}", stripe::product());
83    println!("  Subscription Status: {}", stripe::subscription_status());
84    println!();
85
86    // Subscription
87    println!("� SUBSCRIPTION:");
88    println!("  Plan:               {}", subscription::plan());
89    println!("  Status:             {}", subscription::status());
90    println!("  Payment Method:     {}", subscription::payment_method());
91    println!();
92}
More examples
Hide additional examples
examples/travel_misc.rs (line 36)
10fn main() {
11    println!("=== Faker-Rust Travel & Miscellaneous Examples ===\n");
12
13    // Travel
14    println!("✈️ TRAVEL:");
15    println!("  Airport Name:        {}", travel::airport::name());
16    println!("  IATA Code:           {}", travel::airport::iata_code());
17    println!("  ICAO Code:           {}", travel::airport::icao_code());
18    println!("  Airport City:        {}", travel::airport::city());
19    println!();
20
21    println!("🚂 TRAIN STATIONS:");
22    println!("  Station Name:        {}", travel::train_station::name());
23    println!("  Station City:        {}", travel::train_station::city());
24    println!("  Railway Line:        {}", travel::train_station::line());
25    println!();
26
27    // Banking & Finance
28    println!("💰 BANKING:");
29    println!("  Bank Name:           {}", bank::name());
30    println!("  Account Number:      {}", bank::account_number());
31    println!("  IBAN:                {}", bank::iban());
32    println!("  SWIFT/BIC:           {}", bank::swift_bic());
33    println!();
34
35    println!("💱 CURRENCY:");
36    println!("  Currency Code:       {}", currency::code());
37    println!("  Currency Name:       {}", currency::name());
38    println!("  Currency Symbol:     {}", currency::symbol());
39    println!();
40
41    // Codes & Numbers
42    println!("📊 CODES & NUMBERS:");
43    println!("  EAN-13:              {}", barcode::ean_13());
44    println!("  UPC-A:               {}", barcode::upc_a());
45    println!("  ISBN:                {}", barcode::isbn());
46    println!("  Number (1-100):      {}", number::number_range(1, 100));
47    println!("  Decimal:             {}", number::decimal(2, 2));
48    println!();
49
50    // Personal attributes
51    println!("🧬 PERSONAL ATTRIBUTES:");
52    println!("  Blood Group:         {}", blood::group());
53    println!("  Gender:              {}", gender::gender());
54    println!("  Boolean:             {}", boolean::boolean());
55    println!();
56
57    // Food & Drink
58    println!("🍔 FOOD & DRINK:");
59    println!("  Food Dish:           {}", food::dish());
60    println!("  Ingredient:          {}", food::ingredient());
61    println!("  Beer Style:          {}", beer::style());
62    println!("  Beer Name:           {}", beer::name());
63    println!("  Coffee Blend:        {}", coffee::blend_name());
64    println!("  Coffee Country:      {}", coffee::country());
65    println!();
66
67    // Science & Space
68    println!("🔬 SCIENCE & SPACE:");
69    println!("  Element:             {}", science::element());
70    println!("  Planet:              {}", space::planet());
71    println!("  Moon:                {}", space::moon());
72    println!("  Galaxy:              {}", space::galaxy());
73    println!();
74
75    // Colors
76    println!("🎨 COLORS:");
77    println!("  Color Name:          {}", color::name());
78    println!("  Hex Color:           {}", color::hex());
79    println!("  RGB:                 {:?}", color::rgb());
80    println!();
81
82    // Lorem Ipsum
83    println!("📝 LOREM IPSUM:");
84    println!("  Word:                {}", lorem::word());
85    println!("  Words (5):           {}", lorem::words(5));
86    println!("  Sentence:            {}", lorem::sentence(None));
87    println!();
88
89    // Education & Work
90    println!("🎓 EDUCATION & WORK:");
91    println!("  University:          {}", university::name());
92    println!("  Job Title:           {}", job::title());
93    println!("  Job Field:           {}", job::field());
94    println!();
95
96    // Military & Vehicles
97    println!("🪖 MILITARY & VEHICLES:");
98    println!("  Army Rank:           {}", military::army_rank());
99    println!("  Marines Rank:        {}", military::marines_rank());
100    println!("  Vehicle Make:        {}", vehicle::make());
101    println!("  Vehicle Type:        {}", vehicle::car_type());
102    println!();
103
104    // Files & Dates
105    println!("📁 FILES & DATES:");
106    println!("  File Extension:      {}", file::extension());
107    println!("  MIME Type:           {}", file::mime_type());
108    println!("  Date Backward:       {}", date::backward(None, None, None));
109    println!("  Date Forward:        {}", date::forward(None, None, None));
110    println!();
111
112    // Time & Hacker
113    println!("⏰ TIME & HACKER:");
114    println!("  Time Forward (1):    {}", time::forward(1));
115    println!("  Hacker Phrase:       {}", hacker::phrase());
116    println!();
117}