Skip to content

Commit 5bac3fc

Browse files
committed
---
yaml --- r: 11766 b: refs/heads/master c: e8f7bb0 h: refs/heads/master v: v3
1 parent 4c4cbe1 commit 5bac3fc

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 91e5a1c8b3c56979b0d7025e83dc378f3d05b208
2+
refs/heads/master: e8f7bb0db1b5ed5e241f3780a6761dd6f5104652
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/libcore/bool.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
// -*- rust -*-
22

3-
#[doc = "Classic Boolean logic reified as ADT"];
3+
#[doc = "Boolean logic"];
44

5-
export t;
65
export not, and, or, xor, implies;
76
export eq, ne, is_true, is_false;
87
export from_str, to_str, all_values, to_bit;
98

10-
#[doc = "The type of boolean logic values"]
11-
type t = bool;
12-
13-
#[doc = "Negation/Inverse"]
14-
pure fn not(v: t) -> t { !v }
9+
#[doc = "Negation / inverse"]
10+
pure fn not(v: bool) -> bool { !v }
1511

1612
#[doc = "Conjunction"]
17-
pure fn and(a: t, b: t) -> t { a && b }
13+
pure fn and(a: bool, b: bool) -> bool { a && b }
1814

1915
#[doc = "Disjunction"]
20-
pure fn or(a: t, b: t) -> t { a || b }
16+
pure fn or(a: bool, b: bool) -> bool { a || b }
17+
18+
#[doc = "
19+
Exclusive or
2120
22-
#[doc = "Exclusive or, i.e. `or(and(a, not(b)), and(not(a), b))`"]
23-
pure fn xor(a: t, b: t) -> t { (a && !b) || (!a && b) }
21+
Identical to `or(and(a, not(b)), and(not(a), b))`
22+
"]
23+
pure fn xor(a: bool, b: bool) -> bool { (a && !b) || (!a && b) }
2424

2525
#[doc = "Implication in the logic, i.e. from `a` follows `b`"]
26-
pure fn implies(a: t, b: t) -> t { !a || b }
26+
pure fn implies(a: bool, b: bool) -> bool { !a || b }
2727

2828
#[doc = "
2929
true if truth values `a` and `b` are indistinguishable in the logic
3030
"]
31-
pure fn eq(a: t, b: t) -> bool { a == b }
31+
pure fn eq(a: bool, b: bool) -> bool { a == b }
3232

3333
#[doc = "true if truth values `a` and `b` are distinguishable in the logic"]
34-
pure fn ne(a: t, b: t) -> bool { a != b }
34+
pure fn ne(a: bool, b: bool) -> bool { a != b }
3535

3636
#[doc = "true if `v` represents truth in the logic"]
37-
pure fn is_true(v: t) -> bool { v }
37+
pure fn is_true(v: bool) -> bool { v }
3838

3939
#[doc = "true if `v` represents falsehood in the logic"]
40-
pure fn is_false(v: t) -> bool { !v }
40+
pure fn is_false(v: bool) -> bool { !v }
4141

4242
#[doc = "Parse logic value from `s`"]
43-
pure fn from_str(s: str) -> option<t> {
43+
pure fn from_str(s: str) -> option<bool> {
4444
alt check s {
4545
"true" { some(true) }
4646
"false" { some(false) }
@@ -49,19 +49,19 @@ pure fn from_str(s: str) -> option<t> {
4949
}
5050

5151
#[doc = "Convert `v` into a string"]
52-
pure fn to_str(v: t) -> str { if v { "true" } else { "false" } }
52+
pure fn to_str(v: bool) -> str { if v { "true" } else { "false" } }
5353

5454
#[doc = "
5555
Iterates over all truth values by passing them to `blk` in an unspecified
5656
order
5757
"]
58-
fn all_values(blk: fn(v: t)) {
58+
fn all_values(blk: fn(v: bool)) {
5959
blk(true);
6060
blk(false);
6161
}
6262

6363
#[doc = "converts truth value to an 8 bit byte"]
64-
pure fn to_bit(v: t) -> u8 { if v { 1u8 } else { 0u8 } }
64+
pure fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } }
6565

6666
#[test]
6767
fn test_bool_from_str() {

0 commit comments

Comments
 (0)