forked from zyedidia/generic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a7d462
commit 04fff3a
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<!-- Code generated by gomarkdoc. DO NOT EDIT --> | ||
|
||
# queue | ||
|
||
```go | ||
import "github.com/zyedidia/generic/queue" | ||
``` | ||
|
||
Package queue provides an implementation of a First In First Out \(FIFO\) queue\. The FIFO queue is implemented using a doubly\-linked list found in the 'list' package\. | ||
|
||
## Index | ||
|
||
- [type FIFOQueue](<#type-fifoqueue>) | ||
- [func New[T any]() *FIFOQueue[T]](<#func-new>) | ||
- [func (q *FIFOQueue[T]) Dequeue() T](<#func-badrecv-dequeue>) | ||
- [func (q *FIFOQueue[T]) Empty() bool](<#func-badrecv-empty>) | ||
- [func (q *FIFOQueue[T]) Enqueue(value T)](<#func-badrecv-enqueue>) | ||
- [func (q *FIFOQueue[T]) Iter() iter.Iter[T]](<#func-badrecv-iter>) | ||
- [func (q *FIFOQueue[T]) Peek() T](<#func-badrecv-peek>) | ||
|
||
|
||
## type [FIFOQueue](<https://github.com/nchengyeeshen/generic/blob/master/queue/fifo_queue.go#L12-L14>) | ||
|
||
FIFOQueue is a simple First In First Out \(FIFO\) queue\. | ||
|
||
```go | ||
type FIFOQueue[T any] struct { | ||
// contains filtered or unexported fields | ||
} | ||
``` | ||
|
||
### func [New](<https://github.com/nchengyeeshen/generic/blob/master/queue/fifo_queue.go#L17>) | ||
|
||
```go | ||
func New[T any]() *FIFOQueue[T] | ||
``` | ||
|
||
New returns an empty First In First Out \(FIFO\) queue\. | ||
|
||
### func \(\*BADRECV\) [Dequeue](<https://github.com/nchengyeeshen/generic/blob/master/queue/fifo_queue.go#L31>) | ||
|
||
```go | ||
func (q *FIFOQueue[T]) Dequeue() T | ||
``` | ||
|
||
Dequeue removes and returns the item at the front of the queue\. | ||
|
||
A panic occurs if the queue is Empty\. | ||
|
||
### func \(\*BADRECV\) [Empty](<https://github.com/nchengyeeshen/generic/blob/master/queue/fifo_queue.go#L46>) | ||
|
||
```go | ||
func (q *FIFOQueue[T]) Empty() bool | ||
``` | ||
|
||
Empty returns true if the queue is empty\. | ||
|
||
### func \(\*BADRECV\) [Enqueue](<https://github.com/nchengyeeshen/generic/blob/master/queue/fifo_queue.go#L24>) | ||
|
||
```go | ||
func (q *FIFOQueue[T]) Enqueue(value T) | ||
``` | ||
|
||
Enqueue inserts 'value' to the end of the queue\. | ||
|
||
### func \(\*BADRECV\) [Iter](<https://github.com/nchengyeeshen/generic/blob/master/queue/fifo_queue.go#L52>) | ||
|
||
```go | ||
func (q *FIFOQueue[T]) Iter() iter.Iter[T] | ||
``` | ||
|
||
Iter returns a forward iterator\, returning items starting from the front to the back of the queue\. | ||
|
||
### func \(\*BADRECV\) [Peek](<https://github.com/nchengyeeshen/generic/blob/master/queue/fifo_queue.go#L41>) | ||
|
||
```go | ||
func (q *FIFOQueue[T]) Peek() T | ||
``` | ||
|
||
Peek returns the item at the front of the queue without removing it\. | ||
|
||
A panic occurs if the queue is Empty\. | ||
|
||
|
||
|
||
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>) |