📝 Commented trait RegisterNum

This commit is contained in:
François Autin 2023-03-29 15:40:35 +02:00
parent 72f560f3ec
commit d77c2448e3
No known key found for this signature in database
GPG Key ID: 343F5D382E1DD77C

View File

@ -6,6 +6,14 @@
use crate::simulator::machine::{NUM_FP_REGS, NUM_INT_REGS}; use crate::simulator::machine::{NUM_FP_REGS, NUM_INT_REGS};
use std::ops::{Add, Sub}; use std::ops::{Add, Sub};
/// Forcing the Register struct's generic type into having the following Traits
///
/// - Add
/// - Sub
/// - PartialEq
/// - Copy
///
/// Generally speaking, only numbers have the combinaison of these traits.
pub trait RegisterNum: Add<Output=Self> + Sub<Output=Self> + PartialEq + Copy {} pub trait RegisterNum: Add<Output=Self> + Sub<Output=Self> + PartialEq + Copy {}
impl RegisterNum for i64 {} impl RegisterNum for i64 {}