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.
Dernier runRéussi#91 · main · 15 min 44 s
0Étoiles
0Forks
40Issues
| 1 | /// Console input and output. |
| 2 | |
| 3 | @extern c "tl_println" |
| 4 | pub fn println :: text: String -> () / <io> |
| 5 | |
| 6 | @extern c "tl_print" |
| 7 | pub fn print :: text: String -> () / <io> |
| 8 | |
| 9 | @extern c "tl_eprintln" |
| 10 | pub fn eprintln :: text: String -> () / <io> |
| 11 | |
| 12 | import 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> { ... } |
| 18 | pub 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 | } |