Standard library / net/textproto

textproto.Pipeline

Coordinates ordered requests and responses with IDs and paired Start/End calls. It is not a transport and does not supply deadlines. Expected stdout: '0 1\n'.

Formal Syntax & Structure

go syntaxgo
type Pipeline struct {}

Working Example

Example Snippetgo
package main
import (  "fmt"  "net/textproto")
func main() {  var p textproto.Pipeline  id := p.Next()  p.StartRequest(id)  p.EndRequest(id)  p.StartResponse(id)  p.EndResponse(id)  fmt.Println(id, p.Next())}
func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference