[][src]Struct rust_poker::hand_indexer_s

#[repr(C)]pub struct hand_indexer_s {
    pub cards_per_round: [u8; 8],
    pub round_start: [u8; 8],
    pub rounds: c_ulong,
    pub configurations: [c_ulong; 8],
    pub permutations: [c_ulong; 8],
    pub round_size: [u64; 8],
    pub permutation_to_configuration: [*mut c_ulong; 8],
    pub permutation_to_pi: [*mut c_ulong; 8],
    pub configuration_to_equal: [*mut c_ulong; 8],
    pub configuration: [*mut [c_ulong; 4]; 8],
    pub configuration_to_suit_size: [*mut [c_ulong; 4]; 8],
    pub configuration_to_offset: [*mut u64; 8],
}

Fields

cards_per_round: [u8; 8]round_start: [u8; 8]rounds: c_ulongconfigurations: [c_ulong; 8]permutations: [c_ulong; 8]round_size: [u64; 8]permutation_to_configuration: [*mut c_ulong; 8]permutation_to_pi: [*mut c_ulong; 8]configuration_to_equal: [*mut c_ulong; 8]configuration: [*mut [c_ulong; 4]; 8]configuration_to_suit_size: [*mut [c_ulong; 4]; 8]configuration_to_offset: [*mut u64; 8]

Implementations

impl hand_indexer_s[src]

Wrapper functions to interface with bindgen binding for hand_indexer_s C library

pub fn new() -> hand_indexer_s[src]

Creates a new hand_indexer_s object

pub fn init(rounds: u32, cards_per_round: Vec<u8>) -> hand_indexer_s[src]

Initializes a new hand_indexer

Example

use rust_poker::hand_indexer_s;
let flop_indexer = hand_indexer_s::init(2, [2, 3].to_vec());

pub fn size(&self, round: u32) -> u64[src]

Return number of indices in a round

pub fn get_index(&self, cards: &[u8]) -> u64[src]

Gets the index for a set of cards

Example

use rust_poker::hand_indexer_s;
let flop_indexer = hand_indexer_s::init(2, [2, 3].to_vec());
// first two cards are hole cards
let cards = [0u8, 1, 5, 6, 7];
let index = flop_indexer.get_index(&cards);

pub fn get_hand(&self, round: u32, index: u64, cards: &mut [u8])[src]

Gets hand for a certain index

Arguments

  • round - round to get hand for
  • cards - cuffer to push cards into

Example

use rust_poker::hand_indexer_s;
let flop_indexer = hand_indexer_s::init(2, [2, 3].to_vec());
let mut cards = [0u8; 5];
let hand_index = 400;
let round = 1;
flop_indexer.get_hand(round, hand_index, &mut cards);

Trait Implementations

impl Clone for hand_indexer_s[src]

impl Copy for hand_indexer_s[src]

impl Debug for hand_indexer_s[src]

impl Send for hand_indexer_s[src]

impl Sync for hand_indexer_s[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,