chore: comments

This commit is contained in:
Sofia Rodrigues
2026-03-03 08:29:55 -03:00
parent 2bed27681a
commit f9f1bdc77b
3 changed files with 12 additions and 5 deletions

View File

@@ -893,7 +893,9 @@ def canContinue (machine : Machine dir) (status : Status) : Machine dir :=
|>.setReaderState .closed
| .receiving, _ => machine
/-- Enqueues body chunks into the writer buffer for encoding and sending. -/
/--
Enqueues body chunks into the writer buffer for encoding and sending.
-/
@[inline]
def sendData (machine : Machine dir) (data : Array Chunk) : Machine dir :=
if data.isEmpty then
@@ -901,12 +903,16 @@ def sendData (machine : Machine dir) (data : Array Chunk) : Machine dir :=
else
machine.modifyWriter (fun writer => { writer with userData := writer.userData ++ data })
/-- Takes and clears all accumulated events, returning the drained array. -/
/--
Takes and clears all accumulated events, returning the drained array.
-/
@[inline]
def takeEvents (machine : Machine dir) : Machine dir × Array (Event dir) :=
({ machine with events := #[] }, machine.events)
/-- Takes all accumulated output to send to the socket. -/
/--
Takes and clears accumulated output bytes, returning them as a buffer.
-/
@[inline]
def takeOutput (machine : Machine dir) : Machine dir × ChunkedBuffer :=
let output := machine.writer.outputData

View File

@@ -489,7 +489,8 @@ def parseReasonPhrase (limits : H1.Config) : Parser String := do
liftOption <| String.fromUTF8? bytes.toByteArray
/--
Parses HTTP status code (3 digits)
Parses a status-code (3 decimal digits), the following reason phrase, and the
terminating CRLF; returns a typed `Status`.
-/
def parseStatusCode (limits : H1.Config) : Parser Status := do
let d1 digit

View File

@@ -71,7 +71,7 @@ inductive Writer.State
| complete
/--
State that it has completed and cannot process more data.
Closed; no further data can be written.
-/
| closed
deriving Inhabited, Repr, BEq