@@ -361,24 +361,28 @@ Rust's set of operators contains very few surprises. Arithmetic is done with
361
361
also a unary prefix operator that negates numbers. As in C, the bitwise operators
362
362
` >> ` , ` << ` , ` & ` , ` | ` , and ` ^ ` are also supported.
363
363
364
- Note that, if applied to an integer value, ` ! ` flips all the bits (like ` ~ ` in
365
- C).
364
+ Note that, if applied to an integer value, ` ! ` flips all the bits (bitwise
365
+ NOT, like ` ~ ` in C).
366
366
367
367
The comparison operators are the traditional ` == ` , ` != ` , ` < ` , ` > ` ,
368
368
` <= ` , and ` >= ` . Short-circuiting (lazy) boolean operators are written
369
369
` && ` (and) and ` || ` (or).
370
370
371
- For type casting, Rust uses the binary ` as ` operator. It takes an
372
- expression on the left side and a type on the right side and will,
373
- if a meaningful conversion exists, convert the result of the
374
- expression to the given type.
371
+ For compile-time type casting, Rust uses the binary ` as ` operator. It takes
372
+ an expression on the left side and a type on the right side and will, if a
373
+ meaningful conversion exists, convert the result of the expression to the
374
+ given type. Generally, ` as ` is only used with the primitive numeric types or
375
+ pointers, and is not overloadable. [ ` transmute ` ] [ transmute ] can be used for
376
+ unsafe C-like casting of same-sized types.
375
377
376
378
~~~~
377
379
let x: f64 = 4.0;
378
380
let y: uint = x as uint;
379
381
assert!(y == 4u);
380
382
~~~~
381
383
384
+ [ transmute ] : http://static.rust-lang.org/doc/master/std/cast/fn.transmute.html
385
+
382
386
## Syntax extensions
383
387
384
388
* Syntax extensions* are special forms that are not built into the language,
0 commit comments