linkedlist

package
v2.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

Buffer is a linked list of node.

func (*Buffer) AllocNode

func (llb *Buffer) AllocNode(n int) []byte

AllocNode allocates a []byte with the given length that is expected to be pushed into the Buffer.

func (*Buffer) Append

func (llb *Buffer) Append(p []byte)

Append is like PushBack but appends b without copying it.

func (*Buffer) Buffered

func (llb *Buffer) Buffered() int

Buffered returns the number of bytes that can be read from the current buffer.

func (*Buffer) Discard

func (llb *Buffer) Discard(n int) (discarded int, err error)

Discard removes some nodes based on n bytes.

func (*Buffer) FreeNode

func (llb *Buffer) FreeNode(p []byte)

FreeNode puts the given []byte back to the pool to free the memory.

func (*Buffer) IsEmpty

func (llb *Buffer) IsEmpty() bool

IsEmpty reports whether l is empty.

func (*Buffer) Len

func (llb *Buffer) Len() int

Len returns the length of the list.

func (*Buffer) Peek

func (llb *Buffer) Peek(maxBytes int) ([][]byte, error)

Peek assembles the up to maxBytes of [][]byte based on the list of node, it won't remove these nodes from l until Discard() is called.

func (*Buffer) PeekWithBytes

func (llb *Buffer) PeekWithBytes(maxBytes int, bs ...[]byte) ([][]byte, error)

PeekWithBytes is like Peek but accepts [][]byte and puts them onto head.

func (*Buffer) Pop

func (llb *Buffer) Pop() []byte

Pop removes and returns the buffer of the head or nil if the list is empty.

func (*Buffer) PushBack

func (llb *Buffer) PushBack(p []byte)

PushBack is a wrapper of pushBack, which accepts []byte as its argument.

func (*Buffer) PushFront

func (llb *Buffer) PushFront(p []byte)

PushFront is a wrapper of pushFront, which accepts []byte as its argument.

func (*Buffer) Read

func (llb *Buffer) Read(p []byte) (n int, err error)

Read reads data from the Buffer.

func (*Buffer) ReadFrom

func (llb *Buffer) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom implements io.ReaderFrom.

func (*Buffer) Reset

func (llb *Buffer) Reset()

Reset removes all elements from this list.

func (*Buffer) WriteTo

func (llb *Buffer) WriteTo(w io.Writer) (n int64, err error)

WriteTo implements io.WriterTo.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL