@@ -308,87 +308,6 @@ fn is_four(x: int) -> bool {
308308}
309309~~~~
310310
311- ## Types
312-
313- The basic types include the usual boolean, integral, and floating-point types.
314-
315- ------------------------- -----------------------------------------------
316- ` () ` Unit, the type that has only a single value
317- ` bool ` Boolean type, with values ` true ` and ` false `
318- ` int ` , ` uint ` Machine-pointer-sized signed and unsigned integers
319- ` i8 ` , ` i16 ` , ` i32 ` , ` i64 ` Signed integers with a specific size (in bits)
320- ` u8 ` , ` u16 ` , ` u32 ` , ` u64 ` Unsigned integers with a specific size
321- ` float ` The largest floating-point type efficiently supported on the target machine
322- ` f32 ` , ` f64 ` Floating-point types with a specific size
323- ` char ` A Unicode character (32 bits)
324- ------------------------- -----------------------------------------------
325-
326- These can be combined in composite types, which will be described in
327- more detail later on (the ` T ` s here stand for any other type,
328- while N should be a literal number):
329-
330- ------------------------- -----------------------------------------------
331- ` [T * N] ` Vector (like an array in other languages) with N elements
332- ` (T1, T2) ` Tuple type; any arity above 1 is supported
333- ` &T ` , ` ~T ` , ` @T ` [ Pointer types] ( #boxes-and-pointers )
334- ------------------------- -----------------------------------------------
335-
336- Some types can only be manipulated by pointer, never directly. For instance,
337- you cannot refer to a string (` str ` ); instead you refer to a pointer to a
338- string (` @str ` , ` ~str ` , or ` &str ` ). These * dynamically-sized* types consist
339- of:
340-
341- ------------------------- -----------------------------------------------
342- ` fn(a: T1, b: T2) -> T3 ` Function types
343- ` str ` String type (in UTF-8)
344- ` [T] ` Vector with unknown size (also called a slice)
345- ` [mut T] ` Mutable vector with unknown size
346- ------------------------- -----------------------------------------------
347-
348- > *** Note*** : In the future, mutability for vectors may be defined by
349- > the slot that contains the vector, not the type of the vector itself,
350- > deprecating [ mut T] syntax.
351-
352- In function types, the return type is specified with an arrow, as in
353- the type ` fn() -> bool ` or the function declaration `fn foo() -> bool
354- { }`. For functions that do not return a meaningful value, you can
355- optionally write ` -> () ` , but usually the return annotation is simply
356- left off, as in ` fn main() { ... } ` .
357-
358- Types can be given names or aliases with ` type ` declarations:
359-
360- ~~~~
361- type MonsterSize = uint;
362- ~~~~
363-
364- This will provide a synonym, ` MonsterSize ` , for unsigned integers. It will not
365- actually create a new, incompatible type—` MonsterSize ` and ` uint ` can be used
366- interchangeably, and using one where the other is expected is not a type
367- error. In that sense, types declared with ` type ` are * structural* : their
368- meaning follows from their structure, and their names are irrelevant in the
369- type system.
370-
371- Sometimes, you want your data types to be * nominal* instead of structural: you
372- want their name to be part of their meaning, so that types with the same
373- structure but different names are not interchangeable. Rust has two ways to
374- create nominal data types: ` struct ` and ` enum ` . They're described in more
375- detail below, but they look like this:
376-
377- ~~~~
378- enum HidingPlaces {
379- Closet(uint),
380- UnderTheBed(uint)
381- }
382-
383- struct HeroicBabysitter {
384- bedtime_stories: uint,
385- sharpened_stakes: uint
386- }
387-
388- struct BabysitterSize(uint); // a single-variant struct
389- enum MonsterSize = uint; // a single-variant enum
390- ~~~~
391-
392311## Literals
393312
394313Integers can be written in decimal (` 144 ` ), hexadecimal (` 0x90 ` ), or
0 commit comments