standard_card 1.2.0

A Lightweight Library for Efficient Card Representation
Documentation
/// Extract the rank value from the card
///
/// # Arguments
/// * `card` - The card to extract the rank from
///
/// # Returns
/// The rank value of the card.
///
/// # Example
/// ```
/// use standard_card::card::get_rank;
///
/// let rank = get_rank(541511);
/// assert_eq!(3, rank);
/// ```
pub fn get_rank(card: i32) -> i32 {
    (card >> 8) & 0xf
}

#[cfg(test)]
mod get_rank {
    use crate::card::get_rank;

    #[test]
    fn ace_of_clubs() {
        // Act
        let actual = get_rank(268471337);

        // Assert
        assert_eq!(actual, 12);
    }
}