pub struct Builder(/* private fields */);Expand description
A loose deal builder — any combination of four hands, no invariants
Use Builder to construct a deal incrementally. Convert it into a
PartialDeal or FullDeal (via the inherent build_partial /
build_full methods, or via TryFrom) once the hands are finalized.
Builder is the only deal type that exposes IndexMut
for in-place mutation.
Implementations§
Source§impl Builder
impl Builder
Sourcepub const fn north(self, hand: Hand) -> Self
pub const fn north(self, hand: Hand) -> Self
Set the hand at Seat::North
Sourcepub const fn east(self, hand: Hand) -> Self
pub const fn east(self, hand: Hand) -> Self
Set the hand at Seat::East
Sourcepub const fn south(self, hand: Hand) -> Self
pub const fn south(self, hand: Hand) -> Self
Set the hand at Seat::South
Sourcepub const fn west(self, hand: Hand) -> Self
pub const fn west(self, hand: Hand) -> Self
Set the hand at Seat::West
Sourcepub fn build_partial(self) -> Result<PartialDeal, Self>
pub fn build_partial(self) -> Result<PartialDeal, Self>
Try to convert this builder into a PartialDeal, validating that each
hand has at most 13 cards and the hands are pairwise disjoint. On
failure the input is returned unchanged as the error.
§Errors
Returns self unchanged if the builder is not a valid subset.
Sourcepub fn build_full(self) -> Result<FullDeal, Self>
pub fn build_full(self) -> Result<FullDeal, Self>
Trait Implementations§
Source§impl From<PartialDeal> for Builder
impl From<PartialDeal> for Builder
Source§fn from(subset: PartialDeal) -> Self
fn from(subset: PartialDeal) -> Self
Converts to this type from the input type.
Source§impl IntoIterator for Builder
impl IntoIterator for Builder
Source§impl TryFrom<Builder> for PartialDeal
impl TryFrom<Builder> for PartialDeal
impl Copy for Builder
impl Eq for Builder
impl StructuralPartialEq for Builder
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnsafeUnpin for Builder
impl UnwindSafe for Builder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more