Skip to main content

Module contract

Module contract 

Source
Expand description

Bidding, penalties, and scoring in contract bridge.

Level wraps a 1..=7 contract level, Bid pairs a level with a Strain, and Contract adds a Penalty (undoubled, doubled, redoubled). Contract::score returns the duplicate score for a given trick count and vulnerability.

§Panic policy

The safe constructors that take raw levels — Level::new, Bid::new, and Contract::new — panic when the level is outside 1..=7, and have Level::try_new for fallible construction. In const contexts the panic becomes a compile-time error.

Structs§

Bid
A call that proposes a contract
Contract
The statement of the pair winning the bidding that they will take at least the number of tricks (in addition to the book of 6 tricks), and the strain denotes the trump suit.
InvalidLevel
Error indicating an invalid level
Level
The level of a contract, from 1 to 7
ParseBidError
Error returned when parsing a Bid fails
ParseContractError
Error returned when parsing a Contract fails
ParseLevelError
Error returned when parsing a Level fails
ParsePenaltyError
Error returned when parsing Penalty fails

Enums§

Penalty
Penalty inflicted on a contract