[−][src]Struct bulls_and_cows::Host
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]
letters: HashSet<T>,
answer_length: usize
) -> Result<Host<T>, HostError<T>>
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]
letters: HashSet<T>,
answer_length: usize
) -> Result<Host<T>, HostError<T>>
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]
letters: HashSet<T>,
answer: Vec<T>
) -> Result<Host<T>, HostError<T>>
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]
letters: HashSet<T>,
answer: Vec<T>
) -> Host<T>
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]
&mut self,
answer_length: usize
) -> Result<(), HostError<T>>
Renew this host with a random answer.
pub fn renew_with_known_answer(
&mut self,
answer: Vec<T>
) -> Result<(), HostError<T>>
[src]
&mut self,
answer: Vec<T>
) -> Result<(), HostError<T>>
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
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,