conversions_rs 1.2.1

A comprehensive unit conversion library, CLI tool, and WebAssembly module with full SI (International System of Units) support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
//! Area conversion functions organized by unit type
//! All conversions use square meters as the base unit for accuracy and consistency

/// Square meters conversion functions
pub mod square_meters {
    /// Converts square meters to square millimeters.
    /// # Arguments
    /// * `value` - The area in square meters to convert
    pub fn to_square_millimeters(value: f64) -> f64 {
        value * 1_000_000.0
    }

    /// Converts square meters to square centimeters.
    /// # Arguments
    /// * `value` - The area in square meters to convert
    pub fn to_square_centimeters(value: f64) -> f64 {
        value * 10_000.0
    }

    /// Converts square meters to square kilometers.
    /// # Arguments
    /// * `value` - The area in square meters to convert
    pub fn to_square_kilometers(value: f64) -> f64 {
        value / 1_000_000.0
    }

    /// Converts square meters to square inches.
    /// # Arguments
    /// * `value` - The area in square meters to convert
    pub fn to_square_inches(value: f64) -> f64 {
        value * 1550.0031
    }

    /// Converts square meters to square feet.
    /// # Arguments
    /// * `value` - The area in square meters to convert
    pub fn to_square_feet(value: f64) -> f64 {
        value * 10.763910417
    }

    /// Converts square meters to square yards.
    /// # Arguments
    /// * `value` - The area in square meters to convert
    pub fn to_square_yards(value: f64) -> f64 {
        value * 1.1959900463
    }

    /// Converts square meters to acres.
    /// # Arguments
    /// * `value` - The area in square meters to convert
    pub fn to_acres(value: f64) -> f64 {
        value / 4046.8564224
    }

    /// Converts square meters to hectares.
    /// # Arguments
    /// * `value` - The area in square meters to convert
    pub fn to_hectares(value: f64) -> f64 {
        value / 10_000.0
    }

    /// Converts square meters to square miles.
    /// # Arguments
    /// * `value` - The area in square meters to convert
    pub fn to_square_miles(value: f64) -> f64 {
        value / 2_589_988.110336
    }
}

/// Square millimeters conversion functions
pub mod square_millimeters {
    /// Converts square millimeters to square meters.
    /// # Arguments
    /// * `value` - The area in square millimeters to convert
    pub fn to_square_meters(value: f64) -> f64 {
        value / 1_000_000.0
    }

    /// Converts square millimeters to square centimeters.
    /// # Arguments
    /// * `value` - The area in square millimeters to convert
    pub fn to_square_centimeters(value: f64) -> f64 {
        value / 100.0
    }

    /// Converts square millimeters to square kilometers.
    /// # Arguments
    /// * `value` - The area in square millimeters to convert
    pub fn to_square_kilometers(value: f64) -> f64 {
        super::square_meters::to_square_kilometers(to_square_meters(value))
    }

    /// Converts square millimeters to square inches.
    /// # Arguments
    /// * `value` - The area in square millimeters to convert
    pub fn to_square_inches(value: f64) -> f64 {
        super::square_meters::to_square_inches(to_square_meters(value))
    }

    /// Converts square millimeters to square feet.
    /// # Arguments
    /// * `value` - The area in square millimeters to convert
    pub fn to_square_feet(value: f64) -> f64 {
        super::square_meters::to_square_feet(to_square_meters(value))
    }

    /// Converts square millimeters to square yards.
    /// # Arguments
    /// * `value` - The area in square millimeters to convert
    pub fn to_square_yards(value: f64) -> f64 {
        super::square_meters::to_square_yards(to_square_meters(value))
    }

    /// Converts square millimeters to acres.
    /// # Arguments
    /// * `value` - The area in square millimeters to convert
    pub fn to_acres(value: f64) -> f64 {
        super::square_meters::to_acres(to_square_meters(value))
    }

    /// Converts square millimeters to hectares.
    /// # Arguments
    /// * `value` - The area in square millimeters to convert
    pub fn to_hectares(value: f64) -> f64 {
        super::square_meters::to_hectares(to_square_meters(value))
    }

    /// Converts square millimeters to square miles.
    /// # Arguments
    /// * `value` - The area in square millimeters to convert
    pub fn to_square_miles(value: f64) -> f64 {
        super::square_meters::to_square_miles(to_square_meters(value))
    }
}

/// Square centimeters conversion functions
pub mod square_centimeters {
    /// Converts square centimeters to square meters.
    /// # Arguments
    /// * `value` - The area in square centimeters to convert
    pub fn to_square_meters(value: f64) -> f64 {
        value / 10_000.0
    }

    /// Converts square centimeters to square millimeters.
    /// # Arguments
    /// * `value` - The area in square centimeters to convert
    pub fn to_square_millimeters(value: f64) -> f64 {
        value * 100.0
    }

    /// Converts square centimeters to square kilometers.
    /// # Arguments
    /// * `value` - The area in square centimeters to convert
    pub fn to_square_kilometers(value: f64) -> f64 {
        super::square_meters::to_square_kilometers(to_square_meters(value))
    }

    /// Converts square centimeters to square inches.
    /// # Arguments
    /// * `value` - The area in square centimeters to convert
    pub fn to_square_inches(value: f64) -> f64 {
        value * 0.15500031
    }

    /// Converts square centimeters to square feet.
    /// # Arguments
    /// * `value` - The area in square centimeters to convert
    pub fn to_square_feet(value: f64) -> f64 {
        super::square_meters::to_square_feet(to_square_meters(value))
    }

    /// Converts square centimeters to square yards.
    /// # Arguments
    /// * `value` - The area in square centimeters to convert
    pub fn to_square_yards(value: f64) -> f64 {
        super::square_meters::to_square_yards(to_square_meters(value))
    }

    /// Converts square centimeters to acres.
    /// # Arguments
    /// * `value` - The area in square centimeters to convert
    pub fn to_acres(value: f64) -> f64 {
        super::square_meters::to_acres(to_square_meters(value))
    }

    /// Converts square centimeters to hectares.
    /// # Arguments
    /// * `value` - The area in square centimeters to convert
    pub fn to_hectares(value: f64) -> f64 {
        super::square_meters::to_hectares(to_square_meters(value))
    }

    /// Converts square centimeters to square miles.
    /// # Arguments
    /// * `value` - The area in square centimeters to convert
    pub fn to_square_miles(value: f64) -> f64 {
        super::square_meters::to_square_miles(to_square_meters(value))
    }
}

/// Square kilometers conversion functions
pub mod square_kilometers {
    /// Converts square kilometers to square meters.
    /// # Arguments
    /// * `value` - The area in square kilometers to convert
    pub fn to_square_meters(value: f64) -> f64 {
        value * 1_000_000.0
    }

    /// Converts square kilometers to square millimeters.
    /// # Arguments
    /// * `value` - The area in square kilometers to convert
    pub fn to_square_millimeters(value: f64) -> f64 {
        super::square_meters::to_square_millimeters(to_square_meters(value))
    }

    /// Converts square kilometers to square centimeters.
    /// # Arguments
    /// * `value` - The area in square kilometers to convert
    pub fn to_square_centimeters(value: f64) -> f64 {
        super::square_meters::to_square_centimeters(to_square_meters(value))
    }

    /// Converts square kilometers to square inches.
    /// # Arguments
    /// * `value` - The area in square kilometers to convert
    pub fn to_square_inches(value: f64) -> f64 {
        super::square_meters::to_square_inches(to_square_meters(value))
    }

    /// Converts square kilometers to square feet.
    /// # Arguments
    /// * `value` - The area in square kilometers to convert
    pub fn to_square_feet(value: f64) -> f64 {
        super::square_meters::to_square_feet(to_square_meters(value))
    }

    /// Converts square kilometers to square yards.
    /// # Arguments
    /// * `value` - The area in square kilometers to convert
    pub fn to_square_yards(value: f64) -> f64 {
        super::square_meters::to_square_yards(to_square_meters(value))
    }

    /// Converts square kilometers to acres.
    /// # Arguments
    /// * `value` - The area in square kilometers to convert
    pub fn to_acres(value: f64) -> f64 {
        value * 247.10538147
    }

    /// Converts square kilometers to hectares.
    /// # Arguments
    /// * `value` - The area in square kilometers to convert
    pub fn to_hectares(value: f64) -> f64 {
        value * 100.0
    }

    /// Converts square kilometers to square miles.
    /// # Arguments
    /// * `value` - The area in square kilometers to convert
    pub fn to_square_miles(value: f64) -> f64 {
        value * 0.3861021585
    }
}

/// Square inches conversion functions
pub mod square_inches {
    /// Converts square inches to square meters.
    /// # Arguments
    /// * `value` - The area in square inches to convert
    pub fn to_square_meters(value: f64) -> f64 {
        value / 1550.0031
    }

    /// Converts square inches to square millimeters.
    /// # Arguments
    /// * `value` - The area in square inches to convert
    pub fn to_square_millimeters(value: f64) -> f64 {
        super::square_meters::to_square_millimeters(to_square_meters(value))
    }

    /// Converts square inches to square centimeters.
    /// # Arguments
    /// * `value` - The area in square inches to convert
    pub fn to_square_centimeters(value: f64) -> f64 {
        value / 0.15500031
    }

    /// Converts square inches to square kilometers.
    /// # Arguments
    /// * `value` - The area in square inches to convert
    pub fn to_square_kilometers(value: f64) -> f64 {
        super::square_meters::to_square_kilometers(to_square_meters(value))
    }

    /// Converts square inches to square feet.
    /// # Arguments
    /// * `value` - The area in square inches to convert
    pub fn to_square_feet(value: f64) -> f64 {
        value / 144.0
    }

    /// Converts square inches to square yards.
    /// # Arguments
    /// * `value` - The area in square inches to convert
    pub fn to_square_yards(value: f64) -> f64 {
        value / 1296.0
    }

    /// Converts square inches to acres.
    /// # Arguments
    /// * `value` - The area in square inches to convert
    pub fn to_acres(value: f64) -> f64 {
        super::square_meters::to_acres(to_square_meters(value))
    }

    /// Converts square inches to hectares.
    /// # Arguments
    /// * `value` - The area in square inches to convert
    pub fn to_hectares(value: f64) -> f64 {
        super::square_meters::to_hectares(to_square_meters(value))
    }

    /// Converts square inches to square miles.
    /// # Arguments
    /// * `value` - The area in square inches to convert
    pub fn to_square_miles(value: f64) -> f64 {
        super::square_meters::to_square_miles(to_square_meters(value))
    }
}

/// Square feet conversion functions
pub mod square_feet {
    /// Converts square feet to square meters.
    /// # Arguments
    /// * `value` - The area in square feet to convert
    pub fn to_square_meters(value: f64) -> f64 {
        value / 10.763910417
    }

    /// Converts square feet to square millimeters.
    /// # Arguments
    /// * `value` - The area in square feet to convert
    pub fn to_square_millimeters(value: f64) -> f64 {
        super::square_meters::to_square_millimeters(to_square_meters(value))
    }

    /// Converts square feet to square centimeters.
    /// # Arguments
    /// * `value` - The area in square feet to convert
    pub fn to_square_centimeters(value: f64) -> f64 {
        super::square_meters::to_square_centimeters(to_square_meters(value))
    }

    /// Converts square feet to square kilometers.
    /// # Arguments
    /// * `value` - The area in square feet to convert
    pub fn to_square_kilometers(value: f64) -> f64 {
        super::square_meters::to_square_kilometers(to_square_meters(value))
    }

    /// Converts square feet to square inches.
    /// # Arguments
    /// * `value` - The area in square feet to convert
    pub fn to_square_inches(value: f64) -> f64 {
        value * 144.0
    }

    /// Converts square feet to square yards.
    /// # Arguments
    /// * `value` - The area in square feet to convert
    pub fn to_square_yards(value: f64) -> f64 {
        value / 9.0
    }

    /// Converts square feet to acres.
    /// # Arguments
    /// * `value` - The area in square feet to convert
    pub fn to_acres(value: f64) -> f64 {
        value / 43560.0
    }

    /// Converts square feet to hectares.
    /// # Arguments
    /// * `value` - The area in square feet to convert
    pub fn to_hectares(value: f64) -> f64 {
        super::square_meters::to_hectares(to_square_meters(value))
    }

    /// Converts square feet to square miles.
    /// # Arguments
    /// * `value` - The area in square feet to convert
    pub fn to_square_miles(value: f64) -> f64 {
        value / 27878400.0
    }
}

/// Square yards conversion functions
pub mod square_yards {
    /// Converts square yards to square meters.
    /// # Arguments
    /// * `value` - The area in square yards to convert
    pub fn to_square_meters(value: f64) -> f64 {
        value / 1.1959900463
    }

    /// Converts square yards to square millimeters.
    /// # Arguments
    /// * `value` - The area in square yards to convert
    pub fn to_square_millimeters(value: f64) -> f64 {
        super::square_meters::to_square_millimeters(to_square_meters(value))
    }

    /// Converts square yards to square centimeters.
    /// # Arguments
    /// * `value` - The area in square yards to convert
    pub fn to_square_centimeters(value: f64) -> f64 {
        super::square_meters::to_square_centimeters(to_square_meters(value))
    }

    /// Converts square yards to square kilometers.
    /// # Arguments
    /// * `value` - The area in square yards to convert
    pub fn to_square_kilometers(value: f64) -> f64 {
        super::square_meters::to_square_kilometers(to_square_meters(value))
    }

    /// Converts square yards to square inches.
    /// # Arguments
    /// * `value` - The area in square yards to convert
    pub fn to_square_inches(value: f64) -> f64 {
        value * 1296.0
    }

    /// Converts square yards to square feet.
    /// # Arguments
    /// * `value` - The area in square yards to convert
    pub fn to_square_feet(value: f64) -> f64 {
        value * 9.0
    }

    /// Converts square yards to acres.
    /// # Arguments
    /// * `value` - The area in square yards to convert
    pub fn to_acres(value: f64) -> f64 {
        value / 4840.0
    }

    /// Converts square yards to hectares.
    /// # Arguments
    /// * `value` - The area in square yards to convert
    pub fn to_hectares(value: f64) -> f64 {
        super::square_meters::to_hectares(to_square_meters(value))
    }

    /// Converts square yards to square miles.
    /// # Arguments
    /// * `value` - The area in square yards to convert
    pub fn to_square_miles(value: f64) -> f64 {
        value / 3097600.0
    }
}

/// Acres conversion functions
pub mod acres {
    /// Converts acres to square meters.
    /// # Arguments
    /// * `value` - The area in acres to convert
    pub fn to_square_meters(value: f64) -> f64 {
        value * 4046.8564224
    }

    /// Converts acres to square millimeters.
    /// # Arguments
    /// * `value` - The area in acres to convert
    pub fn to_square_millimeters(value: f64) -> f64 {
        super::square_meters::to_square_millimeters(to_square_meters(value))
    }

    /// Converts acres to square centimeters.
    /// # Arguments
    /// * `value` - The area in acres to convert
    pub fn to_square_centimeters(value: f64) -> f64 {
        super::square_meters::to_square_centimeters(to_square_meters(value))
    }

    /// Converts acres to square kilometers.
    /// # Arguments
    /// * `value` - The area in acres to convert
    pub fn to_square_kilometers(value: f64) -> f64 {
        value / 247.10538147
    }

    /// Converts acres to square inches.
    /// # Arguments
    /// * `value` - The area in acres to convert
    pub fn to_square_inches(value: f64) -> f64 {
        super::square_meters::to_square_inches(to_square_meters(value))
    }

    /// Converts acres to square feet.
    /// # Arguments
    /// * `value` - The area in acres to convert
    pub fn to_square_feet(value: f64) -> f64 {
        value * 43560.0
    }

    /// Converts acres to square yards.
    /// # Arguments
    /// * `value` - The area in acres to convert
    pub fn to_square_yards(value: f64) -> f64 {
        value * 4840.0
    }

    /// Converts acres to hectares.
    /// # Arguments
    /// * `value` - The area in acres to convert
    pub fn to_hectares(value: f64) -> f64 {
        value * 0.40468564224
    }

    /// Converts acres to square miles.
    /// # Arguments
    /// * `value` - The area in acres to convert
    pub fn to_square_miles(value: f64) -> f64 {
        value / 640.0
    }
}

/// Hectares conversion functions
pub mod hectares {
    /// Converts hectares to square meters.
    /// # Arguments
    /// * `value` - The area in hectares to convert
    pub fn to_square_meters(value: f64) -> f64 {
        value * 10_000.0
    }

    /// Converts hectares to square millimeters.
    /// # Arguments
    /// * `value` - The area in hectares to convert
    pub fn to_square_millimeters(value: f64) -> f64 {
        super::square_meters::to_square_millimeters(to_square_meters(value))
    }

    /// Converts hectares to square centimeters.
    /// # Arguments
    /// * `value` - The area in hectares to convert
    pub fn to_square_centimeters(value: f64) -> f64 {
        super::square_meters::to_square_centimeters(to_square_meters(value))
    }

    /// Converts hectares to square kilometers.
    /// # Arguments
    /// * `value` - The area in hectares to convert
    pub fn to_square_kilometers(value: f64) -> f64 {
        value / 100.0
    }

    /// Converts hectares to square inches.
    /// # Arguments
    /// * `value` - The area in hectares to convert
    pub fn to_square_inches(value: f64) -> f64 {
        super::square_meters::to_square_inches(to_square_meters(value))
    }

    /// Converts hectares to square feet.
    /// # Arguments
    /// * `value` - The area in hectares to convert
    pub fn to_square_feet(value: f64) -> f64 {
        super::square_meters::to_square_feet(to_square_meters(value))
    }

    /// Converts hectares to square yards.
    /// # Arguments
    /// * `value` - The area in hectares to convert
    pub fn to_square_yards(value: f64) -> f64 {
        super::square_meters::to_square_yards(to_square_meters(value))
    }

    /// Converts hectares to acres.
    /// # Arguments
    /// * `value` - The area in hectares to convert
    pub fn to_acres(value: f64) -> f64 {
        value / 0.40468564224
    }

    /// Converts hectares to square miles.
    /// # Arguments
    /// * `value` - The area in hectares to convert
    pub fn to_square_miles(value: f64) -> f64 {
        super::square_meters::to_square_miles(to_square_meters(value))
    }
}

/// Square miles conversion functions
pub mod square_miles {
    /// Converts square miles to square meters.
    /// # Arguments
    /// * `value` - The area in square miles to convert
    pub fn to_square_meters(value: f64) -> f64 {
        value * 2_589_988.110336
    }

    /// Converts square miles to square millimeters.
    /// # Arguments
    /// * `value` - The area in square miles to convert
    pub fn to_square_millimeters(value: f64) -> f64 {
        super::square_meters::to_square_millimeters(to_square_meters(value))
    }

    /// Converts square miles to square centimeters.
    /// # Arguments
    /// * `value` - The area in square miles to convert
    pub fn to_square_centimeters(value: f64) -> f64 {
        super::square_meters::to_square_centimeters(to_square_meters(value))
    }

    /// Converts square miles to square kilometers.
    /// # Arguments
    /// * `value` - The area in square miles to convert
    pub fn to_square_kilometers(value: f64) -> f64 {
        value / 0.3861021585
    }

    /// Converts square miles to square inches.
    /// # Arguments
    /// * `value` - The area in square miles to convert
    pub fn to_square_inches(value: f64) -> f64 {
        super::square_meters::to_square_inches(to_square_meters(value))
    }

    /// Converts square miles to square feet.
    /// # Arguments
    /// * `value` - The area in square miles to convert
    pub fn to_square_feet(value: f64) -> f64 {
        value * 27878400.0
    }

    /// Converts square miles to square yards.
    /// # Arguments
    /// * `value` - The area in square miles to convert
    pub fn to_square_yards(value: f64) -> f64 {
        value * 3097600.0
    }

    /// Converts square miles to acres.
    /// # Arguments
    /// * `value` - The area in square miles to convert
    pub fn to_acres(value: f64) -> f64 {
        value * 640.0
    }

    /// Converts square miles to hectares.
    /// # Arguments
    /// * `value` - The area in square miles to convert
    pub fn to_hectares(value: f64) -> f64 {
        super::square_meters::to_hectares(to_square_meters(value))
    }
}

// Legacy function wrappers for backward compatibility
pub fn square_meters_to_square_millimeters(square_meters: f64) -> f64 {
    square_meters::to_square_millimeters(square_meters)
}

pub fn square_millimeters_to_square_meters(square_millimeters: f64) -> f64 {
    square_millimeters::to_square_meters(square_millimeters)
}

pub fn square_meters_to_square_centimeters(square_meters: f64) -> f64 {
    square_meters::to_square_centimeters(square_meters)
}

pub fn square_centimeters_to_square_meters(square_centimeters: f64) -> f64 {
    square_centimeters::to_square_meters(square_centimeters)
}

pub fn square_meters_to_square_kilometers(square_meters: f64) -> f64 {
    square_meters::to_square_kilometers(square_meters)
}

pub fn square_kilometers_to_square_meters(square_kilometers: f64) -> f64 {
    square_kilometers::to_square_meters(square_kilometers)
}

pub fn square_meters_to_square_feet(square_meters: f64) -> f64 {
    square_meters::to_square_feet(square_meters)
}

pub fn square_feet_to_square_meters(square_feet: f64) -> f64 {
    square_feet::to_square_meters(square_feet)
}

pub fn square_meters_to_acres(square_meters: f64) -> f64 {
    square_meters::to_acres(square_meters)
}

pub fn acres_to_square_meters(acres: f64) -> f64 {
    acres::to_square_meters(acres)
}

/// General area conversion function that accepts string unit names
///
/// Converts an area value from one unit to another using string identifiers.
/// This function is case-insensitive and supports common abbreviations.
///
/// # Arguments
///
/// * `value` - The numeric value to convert
/// * `from_unit` - The source unit (e.g., "m²", "cm²", "km²", "ft²", "in²", "ac", "ha")
/// * `to_unit` - The target unit using the same abbreviations
///
/// # Returns
/// * `Ok(f64)` - The converted value
/// * `Err(String)` - Error message if the conversion is not supported
///
/// # Examples
///
/// ```rust
/// use conversions_rs::convert_area;
///
/// let square_centimeters = convert_area(2.5, "m²", "cm²").unwrap();
/// assert_eq!(square_centimeters, 25000.0);
///
/// let acres = convert_area(10000.0, "m²", "ac").unwrap();
/// assert!((acres - 2.471).abs() < 0.001);
/// ```
pub fn convert_area(value: f64, from_unit: &str, to_unit: &str) -> Result<f64, String> {
    let from_unit = from_unit.to_lowercase();
    let to_unit = to_unit.to_lowercase();

    // Convert input to square meters first
    let square_meters = match from_unit.as_str() {
        "" | "m2" | "sq_m" | "square_meters" => value,
        "mm²" | "mm2" | "sq_mm" | "square_millimeters" => {
            square_millimeters::to_square_meters(value)
        }
        "cm²" | "cm2" | "sq_cm" | "square_centimeters" => {
            square_centimeters::to_square_meters(value)
        }
        "km²" | "km2" | "sq_km" | "square_kilometers" => {
            square_kilometers::to_square_meters(value)
        }
        "in²" | "in2" | "sq_in" | "square_inches" => square_inches::to_square_meters(value),
        "ft²" | "ft2" | "sq_ft" | "square_feet" => square_feet::to_square_meters(value),
        "yd²" | "yd2" | "sq_yd" | "square_yards" => square_yards::to_square_meters(value),
        "ac" | "acre" | "acres" => acres::to_square_meters(value),
        "ha" | "hectare" | "hectares" => hectares::to_square_meters(value),
        "mi²" | "mi2" | "sq_mi" | "square_miles" => square_miles::to_square_meters(value),
        _ => return Err(format!("Unsupported area unit: {}", from_unit)),
    };

    // Convert square meters to target unit
    let result = match to_unit.as_str() {
        "" | "m2" | "sq_m" | "square_meters" => square_meters,
        "mm²" | "mm2" | "sq_mm" | "square_millimeters" => {
            square_meters::to_square_millimeters(square_meters)
        }
        "cm²" | "cm2" | "sq_cm" | "square_centimeters" => {
            square_meters::to_square_centimeters(square_meters)
        }
        "km²" | "km2" | "sq_km" | "square_kilometers" => {
            square_meters::to_square_kilometers(square_meters)
        }
        "in²" | "in2" | "sq_in" | "square_inches" => {
            square_meters::to_square_inches(square_meters)
        }
        "ft²" | "ft2" | "sq_ft" | "square_feet" => square_meters::to_square_feet(square_meters),
        "yd²" | "yd2" | "sq_yd" | "square_yards" => square_meters::to_square_yards(square_meters),
        "ac" | "acre" | "acres" => square_meters::to_acres(square_meters),
        "ha" | "hectare" | "hectares" => square_meters::to_hectares(square_meters),
        "mi²" | "mi2" | "sq_mi" | "square_miles" => square_meters::to_square_miles(square_meters),
        _ => return Err(format!("Unsupported area unit: {}", to_unit)),
    };

    Ok(result)
}