9561def209
Resources are now defined like... resource fd(int n) { close(n); } Calling fd with an int will then produce a non-copyable value that, when dropped, will call close on the given int.
17 lines
314 B
Rust
17 lines
314 B
Rust
|
|
|
|
|
|
// -*- rust -*-
|
|
|
|
// Tests for alt as expressions resulting in boxed types
|
|
fn test_box() {
|
|
auto res = alt (true) { case (true) { @100 } };
|
|
assert (*res == 100);
|
|
}
|
|
|
|
fn test_str() {
|
|
auto res = alt (true) { case (true) { "happy" } };
|
|
assert (res == "happy");
|
|
}
|
|
|
|
fn main() { test_box(); test_str(); } |