How would you write this in Rust? This is pretty readable to me
#include <variant>
#include <cstdint>
using my_variant = std::variant<int, uint64_t, float, double>;
struct visitor {
void operator()(std::integral auto& r) {
r += 3;
}
void operator()(std::floating_point auto& r) {
r += 3.14;
}
};
int main() {
my_variant v1 = int(1);
my_variant v2 = uint64_t(0xFFFFFFFFFFFFFFFF);
my_variant v3 = float(1.0);
my_variant v4 = double(1.0);
std::visit(visitor(), v1);
std::visit(visitor(), v2);
std::visit(visitor(), v3);
std::visit(visitor(), v4);
}