tobogganSe connecter

louise

The Louise language: compiler, runtime, std, tooling

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

26 lignes · 786 octetsBrut · Historique
1/// Console input and output.
2
3@extern c "tl_println"
4pub fn println :: text: String -> () / <io>
5
6@extern c "tl_print"
7pub fn print :: text: String -> () / <io>
8
9@extern c "tl_eprintln"
10pub fn eprintln :: text: String -> () / <io>
11
12import std/ffi.{type Resource}
13
14/// A byte stream: a TCP connection (`std/net`) or a TLS one (`std/tls`),
15/// keyed by its marker type, so code can take either:
16///
17/// fn echo(conn: Resource<s>) -> () / <io> where Stream<s> { ... }
18pub trait Stream<s>
19{
20 /// Up to `max` bytes; empty at the end of the stream.
21 fn read :: conn: Resource<s> max: Int -> Result<Bytes, String> / <io>
22 /// All of `data`.
23 fn write :: conn: Resource<s> data: Bytes -> Result<(), String> / <io>
24 /// Close the stream.
25 fn close :: conn: Resource<s> -> () / <io>
26}