summaryrefslogtreecommitdiff
path: root/aoc/day.go
blob: 7505223827ec09b04f9ae4d1f1976c04e743cd8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package aoc

import (
	"bufio"
	"context"
)

type Reader[T any] interface {
	Read(ctx context.Context, scanner *bufio.Scanner) (T, error)
}

type Solver[T any, R any] interface {
	Solve(ctx context.Context, data T) (R, error)
}

func RunDay[T any, R any](ctx context.Context, in Reader[T], solvers ...Solver[T, R]) {
	ctx, cancel := context.WithCancel(ctx)
	defer cancel()
}