@@ -354,67 +354,40 @@ grow on you (hopefully).
354
354
355
355
## Types
356
356
357
- The basic types are written like this:
358
-
359
- ` () `
360
- : Nil, the type that has only a single value.
361
-
362
- ` bool `
363
- : Boolean type, with values ` true ` and ` false ` .
364
-
365
- ` int `
366
- : A machine-pointer-sized integer.
367
-
368
- ` uint `
369
- : A machine-pointer-sized unsigned integer.
370
-
371
- ` i8 ` , ` i16 ` , ` i32 ` , ` i64 `
372
- : Signed integers with a specific size (in bits).
373
-
374
- ` u8 ` , ` u16 ` , ` u32 ` , ` u64 `
375
- : Unsigned integers with a specific size.
376
-
377
- ` float `
378
- : The largest floating-point type efficiently supported on the target
379
- machine.
380
-
381
- ` f32 ` , ` f64 `
382
- : Floating-point types with a specific size.
383
-
384
- ` char `
385
- : A Unicode character (32 bits).
357
+ The basic types include the usual boolean, integral, and floating point types.
358
+
359
+ ------------------------- -----------------------------------------------
360
+ ` () ` Nil, the type that has only a single value
361
+ ` bool ` Boolean type, with values ` true ` and ` false `
362
+ ` int ` , ` uint ` Machine-pointer-sized signed and unsigned integers
363
+ ` i8 ` , ` i16 ` , ` i32 ` , ` i64 ` Signed integers with a specific size (in bits)
364
+ ` u8 ` , ` u16 ` , ` u32 ` , ` u64 ` Unsigned integers with a specific size
365
+ ` float ` The largest floating-point type efficiently supported on the target machine
366
+ ` f32 ` , ` f64 ` Floating-point types with a specific size.
367
+ ` char ` A Unicode character (32 bits).
368
+ ------------------------- -----------------------------------------------
386
369
387
370
These can be combined in composite types, which will be described in
388
371
more detail later on (the ` T ` s here stand for any other type):
389
372
390
- ` [T * N] `
391
- : Vector (like an array in other languages) with N elements.
392
-
393
- ` [mut T * N] `
394
- : Mutable vector with N elements.
395
-
396
- ` (T1, T2) `
397
- : Tuple type. Any arity above 1 is supported.
398
-
399
- ` @T ` , ` ~T ` , ` &T `
400
- : Pointer types. See [ Boxes and pointers] ( #boxes-and-pointers ) for an explanation of what ` @ ` , ` ~ ` , and ` & ` mean.
373
+ ------------------------- -----------------------------------------------
374
+ ` [T * N] ` Vector (like an array in other languages) with N elements
375
+ ` [mut T * N] ` Mutable vector with N elements
376
+ ` (T1, T2) ` Tuple type. Any arity above 1 is supported
377
+ ` @T ` , ` ~T ` , ` &T ` [ Pointer types] ( #boxes-and-pointers )
378
+ ------------------------- -----------------------------------------------
401
379
402
380
Some types can only be manipulated by pointer, never directly. For instance,
403
381
you cannot refer to a string (` str ` ); instead you refer to a pointer to a
404
382
string (` @str ` , ` ~str ` , or ` &str ` ). These * dynamically-sized* types consist
405
383
of:
406
384
407
- ` fn(arg1: T1, arg2: T2) -> T3 `
408
- : Function types.
409
-
410
- ` str `
411
- : String type (in UTF-8).
412
-
413
- ` [T] `
414
- : Vector with unknown size (also called a slice).
415
-
416
- ` [mut T] `
417
- : Mutable vector with unknown size.
385
+ ------------------------- -----------------------------------------------
386
+ ` fn(a: T1, b: T2) -> T3 ` Function types
387
+ ` str ` String type (in UTF-8)
388
+ ` [T] ` Vector with unknown size (also called a slice)
389
+ ` [mut T] ` Mutable vector with unknown size
390
+ ------------------------- -----------------------------------------------
418
391
419
392
Types can be given names with ` type ` declarations:
420
393
0 commit comments