pub struct AocSession(/* private fields */);
Expand description
Value of the session cookie for Advent of Code.
For example, this value can be used to get access to the puzzle input.
§Examples
§Debug-print the session cookie value to stdout:
use aoc_session::aoc_session;
let session_id: String = match aoc_session() {
Ok(session) => format!("{session:?}"),
Err(e) => panic!("Error: {e}"),
};
assert!(session_id.starts_with("session="));
println!("{}", session_id);
§Convert the session cookie value to a String
:
use aoc_session::aoc_session;
let session_id: String = match aoc_session() {
Ok(session) => session.to_string(),
Err(e) => panic!("Error: {e}"),
};
assert!(session_id.len() > 0);
assert!(!session_id.starts_with("session="));
println!("My session ID: {}", session_id);
Trait Implementations§
Source§impl Debug for AocSession
impl Debug for AocSession
Auto Trait Implementations§
impl Freeze for AocSession
impl RefUnwindSafe for AocSession
impl Send for AocSession
impl Sync for AocSession
impl Unpin for AocSession
impl UnwindSafe for AocSession
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