iterreader

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

iterreader defines functions that converts an iterator to io.Reader.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryMarshaler

func BinaryMarshaler[Enc encoding.BinaryMarshaler](sep []byte, seq iter.Seq[Enc]) io.Reader

BinaryMarshaler is Reader where marshaler is encoding.BinaryMarshaler.MarshalBinary. sep is appended to every result of the invocation.

func Reader

func Reader[V any](marshaler func(V) ([]byte, error), seq iter.Seq[V]) io.Reader

Reader returns a reader which reads values from seq marshaled by marshaler. seq must be stateful and one-shot; each time Read is called one or more values are yielded from seq. If seq is pure and reuseable, Read reads same value repeatedly. You can use iterable.Resumable or iterable.Peekable to convert a pure iterator to one-shot.

func TextMarshaler

func TextMarshaler[Enc encoding.TextMarshaler](sep []byte, seq iter.Seq[Enc]) io.Reader

TextMarshaler is Reader where marshaler is encoding.TextMarshaler.MarshalText. sep is appended to every result of the invocation.

Types

This section is empty.

Jump to

Keyboard shortcuts

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