pub enum Value {
Show 13 variants
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Ten,
Jack,
Queen,
King,
Ace,
}
Expand description
Re-export Card, Value, and Suit Card rank or value. This is basically the face value - 2
Variants§
Implementations§
source§impl Value
impl Value
sourcepub fn from_u8(v: u8) -> Self
pub fn from_u8(v: u8) -> Self
Take a u32 and convert it to a value.
Examples
use rs_poker::core::Value;
assert_eq!(Value::Four, Value::from_u8(Value::Four as u8));
sourcepub const fn values() -> [Self; 13]
pub const fn values() -> [Self; 13]
Get all of the Value
’s that are possible.
This is used to iterate through all possible
values when creating a new deck, or
generating all possible starting hands.
sourcepub fn from_char(c: char) -> Option<Self>
pub fn from_char(c: char) -> Option<Self>
Given a character parse that char into a value. Case is ignored as long as the char is in the ascii range (It should be). @returns None if there’s no value there.
Examples
use rs_poker::core::Value;
assert_eq!(Value::Ace, Value::from_char('A').unwrap());
Trait Implementations§
source§impl Ord for Value
impl Ord for Value
source§impl PartialEq<Value> for Value
impl PartialEq<Value> for Value
source§impl PartialOrd<Value> for Value
impl PartialOrd<Value> for Value
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl TryFrom<char> for Value
impl TryFrom<char> for Value
source§fn try_from(value: char) -> Result<Self, Self::Error>
fn try_from(value: char) -> Result<Self, Self::Error>
use rs_poker::core::*;
use std::convert::TryFrom;
assert_eq!(Value::Jack, Value::try_from('j').unwrap());
assert_eq!(Value::Jack, Value::try_from('J').unwrap());
§type Error = RSPokerError
type Error = RSPokerError
The type returned in the event of a conversion error.
impl Copy for Value
impl Eq for Value
impl StructuralEq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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