@@ -43,10 +43,13 @@ use from_str::FromStr;
43
43
* Negation of a boolean value.
44
44
*
45
45
* # Examples
46
- * ~~~
46
+ *
47
+ * ~~~ {.rust}
47
48
* rusti> std::bool::not(true)
48
49
* false
49
50
* ~~~
51
+ *
52
+ * ~~~ {.rust}
50
53
* rusti> std::bool::not(false)
51
54
* true
52
55
* ~~~
@@ -57,10 +60,13 @@ pub fn not(v: bool) -> bool { !v }
57
60
* Conjunction of two boolean values.
58
61
*
59
62
* # Examples
60
- * ~~~
63
+ *
64
+ * ~~~ {.rust}
61
65
* rusti> std::bool::and(true, false)
62
66
* false
63
67
* ~~~
68
+ *
69
+ * ~~~ {.rust}
64
70
* rusti> std::bool::and(true, true)
65
71
* true
66
72
* ~~~
@@ -71,10 +77,13 @@ pub fn and(a: bool, b: bool) -> bool { a && b }
71
77
* Disjunction of two boolean values.
72
78
*
73
79
* # Examples
74
- * ~~~
80
+ *
81
+ * ~~~ {.rust}
75
82
* rusti> std::bool::or(true, false)
76
83
* true
77
84
* ~~~
85
+ *
86
+ * ~~~ {.rust}
78
87
* rusti> std::bool::or(false, false)
79
88
* false
80
89
* ~~~
@@ -87,10 +96,13 @@ pub fn or(a: bool, b: bool) -> bool { a || b }
87
96
* 'exclusive or' is identical to `or(and(a, not(b)), and(not(a), b))`.
88
97
*
89
98
* # Examples
90
- * ~~~
99
+ *
100
+ * ~~~ {.rust}
91
101
* rusti> std::bool::xor(true, false)
92
102
* true
93
103
* ~~~
104
+ *
105
+ * ~~~ {.rust}
94
106
* rusti> std::bool::xor(true, true)
95
107
* false
96
108
* ~~~
@@ -105,10 +117,12 @@ pub fn xor(a: bool, b: bool) -> bool { (a && !b) || (!a && b) }
105
117
* 'if a then b' is equivalent to `!a || b`.
106
118
*
107
119
* # Examples
108
- * ~~~
120
+ *
121
+ * ~~~ {.rust}
109
122
* rusti> std::bool::implies(true, true)
110
123
* true
111
- * ~~~
124
+ *
125
+ * ~~~ {.rust}
112
126
* rusti> std::bool::implies(true, false)
113
127
* false
114
128
* ~~~
@@ -121,10 +135,13 @@ pub fn implies(a: bool, b: bool) -> bool { !a || b }
121
135
* Two booleans are equal if they have the same value.
122
136
*
123
137
* # Examples
124
- * ~~~
138
+ *
139
+ * ~~~ {.rust}
125
140
* rusti> std::bool::eq(false, true)
126
141
* false
127
142
* ~~~
143
+ *
144
+ * ~~~ {.rust}
128
145
* rusti> std::bool::eq(false, false)
129
146
* true
130
147
* ~~~
@@ -137,10 +154,13 @@ pub fn eq(a: bool, b: bool) -> bool { a == b }
137
154
* Two booleans are not equal if they have different values.
138
155
*
139
156
* # Examples
140
- * ~~~
157
+ *
158
+ * ~~~ {.rust}
141
159
* rusti> std::bool::ne(false, true)
142
160
* true
143
161
* ~~~
162
+ *
163
+ * ~~~ {.rust}
144
164
* rusti> std::bool::ne(false, false)
145
165
* false
146
166
* ~~~
@@ -151,10 +171,13 @@ pub fn ne(a: bool, b: bool) -> bool { a != b }
151
171
* Is a given boolean value true?
152
172
*
153
173
* # Examples
154
- * ~~~
174
+ *
175
+ * ~~~ {.rust}
155
176
* rusti> std::bool::is_true(true)
156
177
* true
157
178
* ~~~
179
+ *
180
+ * ~~~ {.rust}
158
181
* rusti> std::bool::is_true(false)
159
182
* false
160
183
* ~~~
@@ -165,10 +188,13 @@ pub fn is_true(v: bool) -> bool { v }
165
188
* Is a given boolean value false?
166
189
*
167
190
* # Examples
168
- * ~~~
191
+ *
192
+ * ~~~ {.rust}
169
193
* rusti> std::bool::is_false(false)
170
194
* true
171
195
* ~~~
196
+ *
197
+ * ~~~ {.rust}
172
198
* rusti> std::bool::is_false(true)
173
199
* false
174
200
* ~~~
@@ -181,13 +207,18 @@ pub fn is_false(v: bool) -> bool { !v }
181
207
* Yields an `Option<bool>`, because `str` may or may not actually be parseable.
182
208
*
183
209
* # Examples
184
- * ~~~
210
+ *
211
+ * ~~~ {.rust}
185
212
* rusti> FromStr::from_str::<bool>("true")
186
213
* Some(true)
187
214
* ~~~
215
+ *
216
+ * ~~~ {.rust}
188
217
* rusti> FromStr::from_str::<bool>("false")
189
218
* Some(false)
190
219
* ~~~
220
+ *
221
+ * ~~~ {.rust}
191
222
* rusti> FromStr::from_str::<bool>("not even a boolean")
192
223
* None
193
224
* ~~~
@@ -206,10 +237,13 @@ impl FromStr for bool {
206
237
* Convert a `bool` to a `str`.
207
238
*
208
239
* # Examples
209
- * ~~~
240
+ *
241
+ * ~~~ {.rust}
210
242
* rusti> std::bool::to_str(true)
211
243
* "true"
212
244
* ~~~
245
+ *
246
+ * ~~~ {.rust}
213
247
* rusti> std::bool::to_str(false)
214
248
* "false"
215
249
* ~~~
@@ -237,10 +271,13 @@ pub fn all_values(blk: &fn(v: bool)) {
237
271
* Convert a `bool` to a `u8`.
238
272
*
239
273
* # Examples
240
- * ~~~
274
+ *
275
+ * ~~~ {.rust}
241
276
* rusti> std::bool::to_bit(true)
242
277
* 1
243
278
* ~~~
279
+ *
280
+ * ~~~ {.rust}
244
281
* rusti> std::bool::to_bit(false)
245
282
* 0
246
283
* ~~~
0 commit comments