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
/// **Note:** Use the alias `ucsi::macros::cast::cast_si_value`.
///
/// ## Deprecated
///
/// Under most circumstances [`Value::cast`] / [`Value::cast_const`] can be used instead.
///
/// ## Example
///
/// ```rust,ignore
/// use ucsi::units::base::m;
/// use ucsi::macros::cast::cast_si_value;
/// use ucsi::Value;
/// use ucsi::unit;
///
/// let raw: Value<f64, m> = Value::new(10.0);
/// let orig = raw * raw;
/// let checked = cast_si_value!(orig => unit!(m * m) as unit!(m ** { -2 }))
/// ```
///
/// ## Syntax
///
/// ```rust,ignore
/// cast_si_value!(value:expr => TypeA as TypeB)
/// ```
///
/// ## Implementation
///
/// This will invoke [`is_same_type_or_panic`][is_same_type_or_panic] with the two given types.
///
/// **Note:** This will not check that the type given is the same as the type of the expression provided.
///
/// [is_same_type_or_panic]: crate::core::units::any::is_same_type_or_panic
/// **Note:** Use the alias `ucsi::macros::cast::infer_cast_si_value`.
///
/// ## Deprecated
///
/// Under most circumstances [`Value::cast`] / [`Value::cast_const`] can be used instead.
///
/// ## Syntax
///
/// ```rust,ignore
/// infer_cast_si_value!(value:expr => TargetType)
/// ```
///
/// ## Implementation
///
/// This works like the [`cast_si_value`][__impl_cast_si_value],
/// but infers the origin expression's value with the help of `type_alias_impl_trait`(TAIT).
///
/// You must enable the TAIT feature when you call this macro.
///
/// ```rust,ignore
/// #![feature(type_alias_impl_trait)]
/// ```
///
/// **Note:** This macro requires the `infer_cast` library feature to be enabled.