[−][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
impl<T> Send for Host<T> where
T: Send,
T: Send,
impl<T> Unpin for Host<T> where
T: Unpin,
T: Unpin,
impl<T> Sync for Host<T> where
T: Sync,
T: Sync,
impl<T> RefUnwindSafe for Host<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> UnwindSafe for Host<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,