// Copyright 2026 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package nettest

type queue[ any] struct {
	headPos int
	head    []
	tail    []
}

func ( *queue[]) () int {
	return len(.head[.headPos:]) + len(.tail)
}

func ( *queue[]) ( ) {
	.tail = append(.tail, )
}

func ( *queue[]) ()  {
	var  
	if .headPos >= len(.head) {
		if len(.tail) == 0 {
			return 
		}
		.head, .headPos, .tail = .tail, 0, .head[:0]
	}
	 := .head[.headPos]
	.head[.headPos] = 
	.headPos++
	return 
}