1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: change optional to result of io (#16075)

This commit is contained in:
yuyi
2022-10-16 14:28:57 +08:00
committed by GitHub
parent 6e46933c55
commit f6844e9766
187 changed files with 1885 additions and 1874 deletions

View File

@@ -42,7 +42,7 @@ pub fn new_connection(conn &net.TcpConn) &SSEConnection {
}
// sse_start is used to send the start of a Server Side Event response.
pub fn (mut sse SSEConnection) start() ? {
pub fn (mut sse SSEConnection) start() ! {
sse.conn.set_write_timeout(sse.write_timeout)
mut start_sb := strings.new_builder(512)
start_sb.write_string('HTTP/1.1 200')
@@ -58,7 +58,7 @@ pub fn (mut sse SSEConnection) start() ? {
// send_message sends a single message to the http client that listens for SSE.
// It does not close the connection, so you can use it many times in a loop.
pub fn (mut sse SSEConnection) send_message(message SSEMessage) ? {
pub fn (mut sse SSEConnection) send_message(message SSEMessage) ! {
mut sb := strings.new_builder(512)
if message.id != '' {
sb.write_string('id: $message.id\n')
@@ -73,5 +73,5 @@ pub fn (mut sse SSEConnection) send_message(message SSEMessage) ? {
sb.write_string('retry: $message.retry\n')
}
sb.write_string('\n')
sse.conn.write(sb)?
sse.conn.write(sb)!
}