sshy 0.1.2

TUI application to make SSH configuration easier
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::ops::{Div, Mul};

pub fn percentage_representation<T: Mul<Output = T> + Div<Output = T> + From<u8> + PartialOrd + Copy>(
    total: T,
    part: T,
) -> T {
    // TODO
    // I'm guessing this is wrong or could be improved. I'm dumb.
    if part <= total {
        part * 100.into() / total
    } else {
        total * 100.into() / total
    }
}