inko: 0.18.1 -> 0.19.1 (#463402)
This commit is contained in:
@@ -15,16 +15,16 @@
|
||||
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "inko";
|
||||
version = "0.18.1";
|
||||
version = "0.19.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "inko-lang";
|
||||
repo = "inko";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-jVfAfR02R2RaTtzFSBoLuq/wdPaaI/eochrZaRVdmHY=";
|
||||
hash = "sha256-ZHVOwYvNRL2ObZt2PvayoqvS64MumN4oXQOgeCWbEUM=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-IOMhwcZHB5jVYDM65zifxCjVHWl1EBbxNA3WVmarWcs=";
|
||||
cargoHash = "sha256-BHrbqPMQnhw8pjN8e0/qW1rPe/fMhs2iUbRVPt5ATrg=";
|
||||
|
||||
buildInputs = [
|
||||
libffi
|
||||
|
||||
@@ -7,26 +7,30 @@
|
||||
|
||||
let
|
||||
source =
|
||||
# https://docs.inko-lang.org/manual/v0.19.1/getting-started/hello-concurrency/#channels
|
||||
writeText "hello.inko" # inko
|
||||
''
|
||||
import std.process (sleep)
|
||||
import std.stdio (STDOUT)
|
||||
import std.stdio (Stdout)
|
||||
import std.sync (Channel)
|
||||
import std.time (Duration)
|
||||
|
||||
class async Printer {
|
||||
fn async print(message: String, channel: Channel[Nil]) {
|
||||
let _ = STDOUT.new.print(message)
|
||||
type async Printer {
|
||||
fn async print(message: String, channel: uni Channel[Nil]) {
|
||||
let _ = Stdout.new.print(message)
|
||||
|
||||
channel.send(nil)
|
||||
}
|
||||
}
|
||||
|
||||
class async Main {
|
||||
type async Main {
|
||||
fn async main {
|
||||
let channel = Channel.new(size: 2)
|
||||
let channel = Channel.new
|
||||
|
||||
Printer().print('Hello', channel)
|
||||
Printer().print('world', channel)
|
||||
Printer().print('Hello', recover channel.clone)
|
||||
Printer().print('world', recover channel.clone)
|
||||
|
||||
sleep(Duration.from_millis(500))
|
||||
|
||||
channel.receive
|
||||
channel.receive
|
||||
|
||||
Reference in New Issue
Block a user