Struct distributed_cards::Deck[][src]

pub struct Deck { /* fields omitted */ }
Expand description

The Deck struct is the starting point to shuffle. It contains n cards. The deck doesn’t care what cards it represents.

Example

let rng = &mut thread_rng();
let primes = [Prime::random(128, rng), Prime::random(128, rng)]; // each participant contributes one prime
let rsa_parameter = RsaParameter::from_primes(&primes);
let uuid = Uuid::from_u128(0x_1905709b_e2ae_469c_9589_4e37dcf3e5bc); // must be unique and unpredictable for each shuffle
let deck = Deck::new(104, uuid);
let (encrypted_deck, key) = deck.shuffle_encrypt(&rsa_parameter, rng);
assert!(deck.is_shuffle_encrypt_valid(&key, &encrypted_deck));

Implementations

Creates a new deck with n cards numbered 0 up to n-1. The given shuffle_id must be unique over all shuffles, but both parameters have to be the same for each participant

1st shuffling phase

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.