From 0ae786244aeea5c66b2305459b1fd14d11c24e88 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Fri, 11 Apr 2025 22:47:43 -0700 Subject: Update documentation --- deque.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deque.go b/deque.go index 4eec0e6..2aa325d 100644 --- a/deque.go +++ b/deque.go @@ -3,9 +3,9 @@ // // This queue has O(1) amortized inserts and removals from both ends of the // container. It also has O(1) indexing like a vector. -package deque - +// // The core implementation is "ported" (stolen) from Rust's VecDeque. +package deque import ( "fmt" @@ -42,7 +42,7 @@ func (q *Deque[T]) toPhysicalIdx(i int) int { return q.wrapAdd(q.head, i) } -// At returns the item at position i. +// At returns the item at position i. At panics if i < 0 or i >= q.Len(). func (q *Deque[T]) At(i int) T { if !(0 <= i && i < len(q.buf)) { panic(fmt.Sprintf("index out of range [%d] with length %d", i, len(q.buf))) -- cgit v1.3.1