Struct bulls_and_cows::Host
source · pub struct Host<T: Eq + Hash + Clone> { /* private fields */ }
Expand description
The game host for generating the question and answering for the question.
Implementations§
source§impl<T: Eq + Hash + Clone> Host<T>
impl<T: Eq + Hash + Clone> Host<T>
pub fn get_letters(&self) -> &HashSet<T>
pub fn get_answer_length(&self) -> usize
pub fn get_answer(&self) -> &[T]
source§impl<T: Eq + Hash + Clone> Host<T>
impl<T: Eq + Hash + Clone> Host<T>
sourcepub fn build(
letters: HashSet<T>,
answer_length: usize
) -> Result<Host<T>, HostError<T>>
pub fn build( letters: HashSet<T>, answer_length: usize ) -> Result<Host<T>, HostError<T>>
Build a bulls-and-cows game host with a fixed answer.
sourcepub fn build_with_random_answer(
letters: HashSet<T>,
answer_length: usize
) -> Result<Host<T>, HostError<T>>
pub fn build_with_random_answer( letters: HashSet<T>, answer_length: usize ) -> Result<Host<T>, HostError<T>>
Build a bulls-and-cows game host with a random answer.
sourcepub fn build_with_known_answer(
letters: HashSet<T>,
answer: Vec<T>
) -> Result<Host<T>, HostError<T>>
pub fn build_with_known_answer( letters: HashSet<T>, answer: Vec<T> ) -> Result<Host<T>, HostError<T>>
Build a bulls-and-cows game host with a known answer.
sourcepub unsafe fn build_with_known_answer_unsafe(
letters: HashSet<T>,
answer: Vec<T>
) -> Host<T>
pub unsafe fn build_with_known_answer_unsafe( letters: HashSet<T>, answer: Vec<T> ) -> Host<T>
Build a bulls-and-cows game host with a known answer unsafely.
sourcepub fn renew_with_random_answer(
&mut self,
answer_length: usize
) -> Result<(), HostError<T>>
pub fn renew_with_random_answer( &mut self, answer_length: usize ) -> Result<(), HostError<T>>
Renew this host with a random answer.
sourcepub fn renew_with_known_answer(
&mut self,
answer: Vec<T>
) -> Result<(), HostError<T>>
pub fn renew_with_known_answer( &mut self, answer: Vec<T> ) -> Result<(), HostError<T>>
Renew this host with a known answer.
sourcepub unsafe fn renew_with_known_answer_unsafe(&mut self, answer: Vec<T>)
pub unsafe fn renew_with_known_answer_unsafe(&mut self, answer: Vec<T>)
Renew this host with a known answer unsafely.
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for Host<T>where T: RefUnwindSafe,
impl<T> Send for Host<T>where T: Send,
impl<T> Sync for Host<T>where T: Sync,
impl<T> Unpin for Host<T>where T: Unpin,
impl<T> UnwindSafe for Host<T>where T: UnwindSafe,
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