~/bend-docscommunity

reply.bend checks

raw source on the hub · import 0x650cd729029c76d9f6151ee977dc0ae8/reply.bend as Reply

Replies: a server answers each command with one or more lines, each a 3-digit code and a separator: "250-" means more lines follow, "250 " (or the bare code) ends the reply. RFC 5321, section 4.2.

2 imports
import Base
import ./text.bend as T

Types

type Reply source · line 8 · raw

Data

A whole reply: its code and its lines' text, joined by LF.

type Split source · line 13 · raw

Data

A buffer cut at the end of its first reply, or kept whole until one arrives in full. A malformed line ends the reply with code 0.

type Rl source · line 18 · raw

Data

One reply line, read.

Definitions

def Reply.digit source · line 25 · raw

@+c:U32 -> Bool

def Reply.sep source · line 28 · raw

@code:U32 -> @rest:String -> Rl

def Reply.ok source · line 37 · raw

@ok:Bool -> @code:U32 -> @rest:String -> Rl

def Reply.line source · line 44 · raw

@l:String -> Rl

def Reply.end source · line 55 · raw

@last:Bool -> @code:U32 -> @rest:String -> @text:String -> @more:(@_:String -> @_:String -> Split) -> Split

def Reply.rl source · line 63 · raw

@rl:Rl -> @rest:String -> @text:String -> @more:(@_:String -> @_:String -> Split) -> Split

def Reply.step source · line 71 · raw

@l:0x650cd729029c76d9f6151ee977dc0ae8/text.Line -> @text:String -> @more:(@_:String -> @_:String -> Split) -> Split

def Reply.scan source · line 80 · raw

@fuel:Nat -> @s:String -> @text:String -> Split

Each line eats at least one byte, so fuel = length + 1 always lasts.

def Reply.fin source · line 87 · raw

@sp:Split -> @buf:String -> Split

def Reply.split source · line 95 · raw

@+buf:String -> Split

The first complete reply in buf, or More{buf}.

def Reply.class source · line 99 · raw

@r:Reply -> U32

The reply's class: 2 done, 3 go on, 4 try later, 5 refused.

def Reply.code source · line 103 · raw

@r:Reply -> U32

def Reply.text source · line 107 · raw

@r:Reply -> String