newnum_proc_macros 0.13.1

Procedural macros reexported by the deprecated `newnum` crate
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
#![expect(clippy::all)]

mod util;

mod derive_abs_diff;
mod derive_empty;
mod derive_min_max;
mod derive_root;
mod derive_round;
mod derive_sign;
mod derive_trig;
mod derive_type_min_max;
mod derive_whole;
mod num;

//
//
//
// SIGN DERIVE MACROS
//
//
//

/// `Signed` derive macro.
/// `Signed` is a trait with methods that check sign attributes.
/// This macro expects the type to only have one field,
/// and redirects the trait methods to the field as `Signed`.
///
/// `Signed`'s methods return `Self::BoolMapped`.
/// This macro expects the field's `BoolMapped` type to be `bool`.
///
/// ### Generics
///
/// For types with generic parameters,
/// `Signed` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(Signed)]
/// #[derive_bound(Signed; T: Signed)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(Signed, attributes(derive_bound))]
pub fn signed_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::signed_derive_macro(input)
}

#[proc_macro_derive(Positive, attributes(derive_bound))]
pub fn positive_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::positive_derive_macro(input)
}
#[proc_macro_derive(Negative, attributes(derive_bound))]
pub fn negative_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::negative_derive_macro(input)
}
#[proc_macro_derive(Zero, attributes(derive_bound, zero))]
pub fn zero_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::zero_derive_macro(input)
}

#[proc_macro_derive(NotPositive, attributes(derive_bound))]
pub fn not_positive_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::not_positive_derive_macro(input)
}
#[proc_macro_derive(NotNegative, attributes(derive_bound))]
pub fn not_negative_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::not_negative_derive_macro(input)
}
#[proc_macro_derive(NotZero, attributes(derive_bound))]
pub fn not_zero_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::not_zero_derive_macro(input)
}

#[proc_macro_derive(AlwaysPositive, attributes(derive_bound))]
pub fn always_positive_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::always_positive_derive_macro(input)
}
#[proc_macro_derive(AlwaysNegative, attributes(derive_bound))]
pub fn always_negative_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::always_negative_derive_macro(input)
}
#[proc_macro_derive(AlwaysZero, attributes(derive_bound, zero))]
pub fn always_zero_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::always_zero_derive_macro(input)
}

#[proc_macro_derive(PositiveOrZero, attributes(derive_bound, zero))]
pub fn positive_or_zero_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::positive_or_zero_derive_macro(input)
}
#[proc_macro_derive(NegativeOrZero, attributes(derive_bound, zero))]
pub fn negative_or_zero_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::negative_or_zero_derive_macro(input)
}
#[proc_macro_derive(PositiveOrNegative, attributes(derive_bound))]
pub fn positive_or_negative_derive_macro(
    input: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
    derive_sign::positive_or_negative_derive_macro(input)
}

#[proc_macro_derive(FullySigned, attributes(derive_bound, zero))]
pub fn fully_signed_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_sign::fully_signed_derive_macro(input)
}

//
//
//
// ABS-DIFF DERIVE MACRO
//
//
//

/// `AbsDiff` derive macro.
/// maps each field using the method.
///
/// ### Generics
///
/// For types with generic parameters,
/// `AbsDiff` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(AbsDiff)]
/// #[derive_bound(AbsDiff; T: AbsDiff<Output = T>)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(AbsDiff, attributes(derive_bound))]
pub fn abs_diff_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_abs_diff::abs_diff_derive_macro(input)
}

//
//
//
// MIN-MAX DERIVE MACROS
//
//
//

/// `MinMax` derive macro.
/// for each method,
/// the derive implementation maps each field using the method.
/// Throws a compile-time error for enums unless you use the `flat_minmax` attribute.
///
/// The `flat_minmax` attribute makes the derived implementation use `PartialOrd` for the entire type instead of `MinMax` for each field,
/// so each field won't be minmaxed seperately.
/// `flat_minmax` works for enums.
///
/// ### Generics
///
/// For types with generic parameters,
/// `MinMax` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(MinMax)]
/// #[derive_bound(MinMax; T: MinMax)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(MinMax, attributes(derive_bound, flat_minmax))]
pub fn min_max_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_min_max::min_max_derive_macro(input)
}

//
//
//
// TYPE-MIN, TYPE-MAX DERIVE MACROS
//
//
//

/// `TypeMin` derive macro.
/// Initializes the `type_min` of each field,
/// and for enum requires a single variant to be labeled as `type_min`.
///
/// ### Generics
///
/// For types with generic parameters,
/// `TypeMin` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(TypeMin)]
/// #[derive_bound(TypeMin; T: TypeMin)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(TypeMin, attributes(derive_bound, type_min))]
pub fn type_min_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_type_min_max::type_min_derive_macro(input)
}

/// `TypeMax` derive macro.
/// Initializes the `type_max` of each field,
/// and for enum requires a single variant to be labeled as `type_max`.
///
/// ### Generics
///
/// For types with generic parameters,
/// `TypeMin` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(TypeMax)]
/// #[derive_bound(TypeMax; T: TypeMax)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(TypeMax, attributes(derive_bound, type_max))]
pub fn type_max_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_type_min_max::type_max_derive_macro(input)
}

//
//
//
// ROUND DERIVE MACRO
//
//
//

/// `Round` derive macro.
/// for each method,
/// the derive implementation maps each field using the method.
///
/// ### Generics
///
/// For types with generic parameters,
/// `Round` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(Round)]
/// #[derive_bound(Round; T: Round)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(Round, attributes(derive_bound))]
pub fn round_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_round::round_derive_macro(input)
}

/// `Whole` derive macro.
/// `Whole` is a trait that has no methods and is used to mark types as always round.
/// This derive macro doesn't verify anything about the data in the type,
/// so make sure the type should be `Whole` when using this derive macro.
///
/// This derive macro also derives `Round`,
/// with an implementation that doesn't do anything to round the values because they are already whole.
///
/// ### Generics
///
/// For types with generic parameters,
/// `Whole` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// * If `derive_bound` is used, the `Round` trait will not be derived automatically,
///   and will need to be seperately derived using the `Round` derive macro.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(Whole, Round)]
/// #[derive_bound(Whole; T: Whole)]
/// #[derive_bound(Round; T: Round)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(Whole, attributes(derive_bound))]
pub fn whole_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_whole::whole_derive_macro(input)
}

//
//
//
// ROOT DERIVE MACROS
//
//
//

/// `TruncRoot` derive macro.
/// for each method,
/// the derive implementation maps each field using the method.
///
/// This derived implementation matches the logical `Mul` derived implementation that multiplies each field seperately.
///
/// ### Generics
///
/// For types with generic parameters,
/// `TruncRoot` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(TruncRoot)]
/// #[derive_bound(TruncRoot; T: TruncRoot)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(TruncRoot, attributes(derive_bound))]
pub fn trunc_root_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_root::trunc_root_derive_macro(input)
}

/// `Root` derive macro.
/// for each method,
/// the derive implementation maps each field using the method.
///
/// This derived implementation matches the logical `Mul` derived implementation that multiplies each field seperately.
///
/// ### Generics
///
/// For types with generic parameters,
/// `Root` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(Root)]
/// #[derive_bound(Root; T: Root)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(Root, attributes(derive_bound))]
pub fn root_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_root::root_derive_macro(input)
}

//
//
//
// TRIG DERIVE MACROS
//
//
//

/// `Trig` derive macro.
/// for each method,
/// the derive implementation maps each field using the method.
///
/// `Trig`'s methods return `Self::Output`.
/// This macro expects that for each field: `T::Output = T`.
///
/// ### Generics
///
/// For types with generic parameters,
/// `Trig` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(Trig)]
/// #[derive_bound(Trig; T: Trig)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(Trig, attributes(derive_bound))]
pub fn trig_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_trig::trig_derive_macro(input)
}

/// `ATrig` derive macro.
/// for each method,
/// the derive implementation maps each field using the method.
///
/// `ATrig`'s methods return `Self::Output`.
/// This macro expects that for each field: `T::Output = T`.
///
/// ### Generics
///
/// For types with generic parameters,
/// `ATrig` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(ATrig)]
/// #[derive_bound(ATrig; T: ATrig)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(ATrig, attributes(derive_bound))]
pub fn atrig_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_trig::atrig_derive_macro(input)
}

/// `Hyper` derive macro.
/// for each method,
/// the derive implementation maps each field using the method.
///
/// `Hyper`'s methods return `Self::Output`.
/// This macro expects that for each field: `T::Output = T`.
///
/// ### Generics
///
/// For types with generic parameters,
/// `Hyper` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(Hyper)]
/// #[derive_bound(Hyper; T: Hyper)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(Hyper, attributes(derive_bound))]
pub fn hyper_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_trig::hyper_derive_macro(input)
}

/// `AHyper` derive macro.
/// for each method,
/// the derive implementation maps each field using the method.
///
/// `AHyper`'s methods return `Self::Output`.
/// This macro expects that for each field: `T::Output = T`.
///
/// ### Generics
///
/// For types with generic parameters,
/// `AHyper` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(AHyper)]
/// #[derive_bound(AHyper; T: AHyper)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(AHyper, attributes(derive_bound))]
pub fn ahyper_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_trig::ahyper_derive_macro(input)
}

//
//
//
// EMPTY DERIVE MACROS
//
//
//

/// `Num` derive macro.
/// `Num` is an empty trait that has many super-traits,
/// this macro only derives `Num` and not its super-traits.
///
/// ### Generics
///
/// For types with generic parameters,
/// `Num` will be implemented with no additional trait-bounds.
///
/// To add bounds to the derive, use the `derive_bound` attribute which follows this syntax:
/// `#[derive_bound(<trait-ident>; <where-predicate>, ...)]`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// #[derive(Num)]
/// #[derive_bound(Num; T: Num)]
/// struct Fun<T>(T);
/// ```
#[proc_macro_derive(Num, attributes(derive_bound))]
pub fn num_derive_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    derive_empty::num_derive_macro(input)
}

//
//
//
// NUM MACROS
//
//
//

/// Converts a numeric literal into a `Num` type, generating a compile-time error if the literal is out of range for the type.
///
/// * the type doesn't have to implement `Num`, but it must implement `FromIntLiteral` and `FromFloatLiteral` for float literal support.
///
/// ### Syntax
///
/// `num!(<literal>)` or `num!(<literal>: <type>)`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// fn inc(value: &mut impl Num) {
///    *value += num!(1)
/// }
/// ```
///
/// ### Compile-Time Error
///
/// Because of rust const-fn limitations,
/// the error shown when the literal is out of range is cryptic and is shown at the macro call-site.
///
/// Example:
///
///```
/// use newnum::*;
///
/// fn add_alot(value: &mut impl Num) {
///     //        |<- ERROR: evaluation of `add_alot::num_macro_fn::<u8>::{constant#0}` failed
///     //        |
///     *value += num!(1000)
/// }
///
/// fn main() {
///     let mut i = 5u8;
///     add_alot(&mut i);
/// }
/// ```
#[proc_macro]
pub fn num(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    num::num(input)
}

/// Converts a numeric literal into a `Num` type, generating a compile-time error if the literal is out of range for the type.
/// In comparison to `num!`, this macro also accepts literals that can only be approximately represented by the type.
///
/// * the type doesn't have to implement `Num`, but it must implement `FromIntLiteral` and `FromFloatLiteral` for float literal support.
///
/// ### Syntax
///
/// `num_approx!(<literal>)` or `num_approx!(<literal>: <type>)`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// fn example<T: Float>() -> T {
///     num_approx!(16_777_217)
/// }
/// ```
///
/// ### Compile-Time Error
///
/// Because of rust const-fn limitations,
/// the error shown when the literal is out of range is cryptic and is shown at the macro call-site.
///
/// Example:
///
///```
/// use newnum::*;
///
/// fn add_alot(value: &mut impl Num) {
///     //        |<- ERROR: evaluation of `add_alot::num_macro_fn::<u8>::{constant#0}` failed
///     //        |
///     *value += num_approx!(1000)
/// }
///
/// fn main() {
///     let mut i = 5u8;
///     add_alot(&mut i);
/// }
/// ```
#[proc_macro]
pub fn num_approx(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    num::num_approx(input)
}

/// Is `num!` but uses `crate` as the crate path. This is useful for macros that are used in the `newnum` crate itself.
///
/// Converts a numeric literal into a `Num` type, generating a compile-time error if the literal is out of range for the type.
///
/// * the type doesn't have to implement `Num`, but it must implement `FromIntLiteral` and `FromFloatLiteral` for float literal support.
///
/// ### Syntax
///
/// `num!(<literal>)` or `num!(<literal>: <type>)`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// fn inc(value: &mut impl Num) {
///    *value += num!(1)
/// }
/// ```
///
/// ### Compile-Time Error
///
/// Because of rust const-fn limitations,
/// the error shown when the literal is out of range is cryptic and is shown at the macro call-site.
///
/// Example:
///
///```
/// use newnum::*;
///
/// fn add_alot(value: &mut impl Num) {
///     //        |<- ERROR: evaluation of `add_alot::num_macro_fn::<u8>::{constant#0}` failed
///     //        |
///     *value += num!(1000)
/// }
///
/// fn main() {
///     let mut i = 5u8;
///     add_alot(&mut i);
/// }
/// ```
#[proc_macro]
pub fn internal_num(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    num::internal_num(input)
}

/// Is `num_approx!` but uses `crate` as the crate path. This is useful for macros that are used in the `newnum` crate itself.
///
/// Converts a numeric literal into a `Num` type, generating a compile-time error if the literal is out of range for the type.
/// In comparison to `num!`, this macro also accepts literals that can only be approximately represented by the type.
///
/// * the type doesn't have to implement `Num`, but it must implement `FromIntLiteral` and `FromFloatLiteral` for float literal support.
///
/// ### Syntax
///
/// `num_approx!(<literal>)` or `num_approx!(<literal>: <type>)`.
///
/// ### Example
///
/// ```
/// use newnum::*;
///
/// fn example<T: Float>() -> T {
///     num_approx!(16_777_217)
/// }
/// ```
///
/// ### Compile-Time Error
///
/// Because of rust const-fn limitations,
/// the error shown when the literal is out of range is cryptic and is shown at the macro call-site.
///
/// Example:
///
///```
/// use newnum::*;
///
/// fn add_alot(value: &mut impl Num) {
///     //        |<- ERROR: evaluation of `add_alot::num_macro_fn::<u8>::{constant#0}` failed
///     //        |
///     *value += num_approx!(1000)
/// }
///
/// fn main() {
///     let mut i = 5u8;
///     add_alot(&mut i);
/// }
/// ```
#[proc_macro]
pub fn internal_num_approx(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    num::internal_num_approx(input)
}