use crate::Rollable; /// Allows `one_d_six::Dice::total` to be used. pub trait DiceTotal { fn dice_total(dice_faces: Vec) -> T; } impl DiceTotal for u8 { fn dice_total(dice_faces: Vec) -> u8 { dice_faces.iter().sum() } } impl DiceTotal for u16 { fn dice_total(dice_faces: Vec) -> u16 { dice_faces.iter().sum() } } impl DiceTotal for u32 { fn dice_total(dice_faces: Vec) -> u32 { dice_faces.iter().sum() } } impl DiceTotal for u64 { fn dice_total(dice_faces: Vec) -> u64 { dice_faces.iter().sum() } } impl DiceTotal for u128 { fn dice_total(dice_faces: Vec) -> u128 { dice_faces.iter().sum() } } impl DiceTotal for usize { fn dice_total(dice_faces: Vec) -> usize { dice_faces.iter().sum() } } impl DiceTotal for i8 { fn dice_total(dice_faces: Vec) -> i8 { dice_faces.iter().sum() } } impl DiceTotal for i16 { fn dice_total(dice_faces: Vec) -> i16 { dice_faces.iter().sum() } } impl DiceTotal for i32 { fn dice_total(dice_faces: Vec) -> i32 { dice_faces.iter().sum() } } impl DiceTotal for i64 { fn dice_total(dice_faces: Vec) -> i64 { dice_faces.iter().sum() } } impl DiceTotal for i128 { fn dice_total(dice_faces: Vec) -> i128 { dice_faces.iter().sum() } } impl DiceTotal for isize { fn dice_total(dice_faces: Vec) -> isize { dice_faces.iter().sum() } }