Skip to main content

AocClient

Trait AocClient 

Source
pub trait AocClient {
    // Required methods
    fn fetch_input(&self, puzzle: Puzzle) -> Result<String, ApiError>;
    fn submit(
        &self,
        puzzle: Puzzle,
        part: Part,
        answer: &str,
    ) -> Result<Verdict, ApiError>;
}
Expand description

Reads puzzle input and submits answers.

Required Methods§

Source

fn fetch_input(&self, puzzle: Puzzle) -> Result<String, ApiError>

Downloads the puzzle input.

§Errors

Returns ApiError if the request fails or the response cannot be interpreted.

Source

fn submit( &self, puzzle: Puzzle, part: Part, answer: &str, ) -> Result<Verdict, ApiError>

Submits an answer and reports how the site responded.

§Errors

Returns ApiError if the request fails or the response cannot be interpreted. Everything the site had to say about the answer itself - including a refusal to judge it yet - is a Verdict, not an error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§