pub struct AocClient { /* private fields */ }
Expand description
Client for interacting with https://adventofcode.com
.
The simplest way to get started is to set AOC_TOKEN
to your personal
session token in your environment and use AocClient::default()
.
Alternatively, you can programatically provide your token with from_token
.
See crate docs on how to optain your token.
// Note that the `default` implementation will panic if `AOC_TOKEN` is missing.
AocClient::default();
AocClient::from_token("your personal session token".to_string());
Implementations§
Source§impl AocClient
impl AocClient
Sourcepub fn from_token(aoc_token: String) -> Self
pub fn from_token(aoc_token: String) -> Self
Create a new client from a AoC session token.
Sourcepub fn get_input(&self, problem: Problem) -> Result<String>
pub fn get_input(&self, problem: Problem) -> Result<String>
Get the personal input for a user for a given problem.
Sourcepub fn submit(
&self,
problem: Problem,
level: Level,
answer: &String,
) -> Result<SubmissionResult>
pub fn submit( &self, problem: Problem, level: Level, answer: &String, ) -> Result<SubmissionResult>
Submit an answer for a problem on a given year, day, and level.
This will not resubmit the answer if the problem has already been
solved from this machine. To track this, the status for each puzzle is
tracked in ./stars
directory. In this case a
SubmissionResult::SkippingAlreadyCompleted is returned.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AocClient
impl !RefUnwindSafe for AocClient
impl Send for AocClient
impl Sync for AocClient
impl Unpin for AocClient
impl !UnwindSafe for AocClient
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