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
//! The actual functions with which we can reconstruct a function in AST-aligned form.
/// A return statement (or final expression without a semicolon).
#[inline]
pub const fn rtn<T>(x: T) -> T {
x
}
/// A variable identified by a path through its enclosing modules.
#[inline]
pub const fn path<T>(x: T) -> T {
x
}
/// A literal, like `true`, `3`, `3.14159`, etc.
#[inline]
pub const fn literal<T>(x: T) -> T {
x
}
/// Addition.
#[inline]
pub fn add<A, B, C>(a: A, b: B) -> C
where
A: core::ops::Add<B, Output = C>,
{
#![allow(clippy::arithmetic_side_effects)]
a + b
}
/// Subtraction.
#[inline]
pub fn sub<A, B, C>(a: A, b: B) -> C
where
A: core::ops::Sub<B, Output = C>,
{
#![allow(clippy::arithmetic_side_effects)]
a - b
}