[][src]Struct bulls_and_cows::Host

pub struct Host<T: Eq + Hash + Clone> { /* fields omitted */ }

The game host for generating the question and answering for the question.

Methods

impl<T: Eq + Hash + Clone> Host<T>[src]

pub fn get_letters(&self) -> &HashSet<T>[src]

pub fn get_answer_length(&self) -> usize[src]

pub fn get_answer(&self) -> &[T][src]

impl<T: Eq + Hash + Clone> Host<T>[src]

pub fn build(
    letters: HashSet<T>,
    answer_length: usize
) -> Result<Host<T>, HostError<T>>
[src]

Build a bulls-and-cows game host with a fixed answer.

pub fn build_with_random_answer(
    letters: HashSet<T>,
    answer_length: usize
) -> Result<Host<T>, HostError<T>>
[src]

Build a bulls-and-cows game host with a random answer.

pub fn build_with_known_answer(
    letters: HashSet<T>,
    answer: Vec<T>
) -> Result<Host<T>, HostError<T>>
[src]

Build a bulls-and-cows game host with a known answer.

pub unsafe fn build_with_known_answer_unsafe(
    letters: HashSet<T>,
    answer: Vec<T>
) -> Host<T>
[src]

Build a bulls-and-cows game host with a known answer unsafely.

pub fn renew_with_random_answer(
    &mut self,
    answer_length: usize
) -> Result<(), HostError<T>>
[src]

Renew this host with a random answer.

pub fn renew_with_known_answer(
    &mut self,
    answer: Vec<T>
) -> Result<(), HostError<T>>
[src]

Renew this host with a known answer.

pub unsafe fn renew_with_known_answer_unsafe(&mut self, answer: Vec<T>)[src]

Renew this host with a known answer unsafely.

impl<T: Eq + Hash + Clone> Host<T>[src]

pub fn answer(&self, answer: &[T]) -> Result<(usize, usize), HostError<T>>[src]

Answer for the question. If the format of the input answer is correct, it returns the number of bulls and the number of cows.

Trait Implementations

impl<T: Debug + Eq + Hash + Clone> Debug for Host<T>[src]

Auto Trait Implementations

impl<T> Sync for Host<T> where
    T: Sync

impl<T> Unpin for Host<T> where
    T: Unpin

impl<T> Send for Host<T> where
    T: Send

impl<T> UnwindSafe for Host<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for Host<T> where
    T: RefUnwindSafe

Blanket Implementations

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

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

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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