@@ -2554,26 +2554,65 @@ a hash representing the crate metadata.
2554
2554
2555
2555
## The core library
2556
2556
2557
- The Rust [ core] library is the language runtime and contains
2558
- required memory management and task scheduling code as well as a
2559
- number of modules necessary for effective usage of the primitive
2560
- types. Methods on [ vectors] and [ strings] , implementations of most
2561
- comparison and math operators, and pervasive types like [ ` Option ` ]
2562
- and [ ` Result ` ] live in core.
2563
-
2564
- All Rust programs link to the core library and import its contents,
2565
- as if the following were written at the top of the crate.
2566
-
2567
- ~~~ {.xfail-test}
2568
- extern mod core;
2569
- use core::*;
2570
- ~~~
2571
-
2572
- [ core ] : core/index.html
2573
- [ vectors ] : core/vec.html
2557
+ The Rust core library provides runtime features required by the language,
2558
+ including the task scheduler and memory allocators, as well as library
2559
+ support for Rust built-in types, platform abstractions, and other commonly
2560
+ used features.
2561
+
2562
+ [ ` core ` ] includes modules corresponding to each of the integer types, each of
2563
+ the floating point types, the [ ` bool ` ] type, [ tuples] , [ characters] , [ strings] ,
2564
+ [ vectors] , [ managed boxes] , [ owned boxes] ,
2565
+ and unsafe and borrowed [ pointers] . Additionally, ` core ` provides
2566
+ some pervasive types ([ ` option ` ] and [ ` result ` ] ),
2567
+ [ task] creation and [ communication] primitives,
2568
+ platform abstractions ([ ` os ` ] and [ ` path ` ] ), basic
2569
+ I/O abstractions ([ ` io ` ] ), [ containers] like [ ` hashmap ` ] ,
2570
+ common traits ([ ` kinds ` ] , [ ` ops ` ] , [ ` cmp ` ] , [ ` num ` ] ,
2571
+ [ ` to_str ` ] , [ ` clone ` ] ), and complete bindings to the C standard library ([ ` libc ` ] ).
2572
+
2573
+ ### Core injection and the Rust prelude
2574
+
2575
+ ` core ` is imported at the topmost level of every crate by default, as
2576
+ if the first line of each crate was
2577
+
2578
+ extern mod core;
2579
+
2580
+ This means that the contents of core can be accessed from from any context
2581
+ with the ` core:: ` path prefix, as in ` use core::vec ` , ` use core::task::spawn ` ,
2582
+ etc.
2583
+
2584
+ Additionally, ` core ` contains a ` prelude ` module that reexports many of the
2585
+ most common core modules, types and traits. The contents of the prelude are
2586
+ imported into every * module* by default. Implicitly, all modules behave as if
2587
+ they contained the following prologue:
2588
+
2589
+ use core::prelude::*;
2590
+
2591
+ [ `core` ] : core/index.html
2592
+ [ `bool` ] : core/bool.html
2593
+ [ tuples ] : core/tuple.html
2594
+ [ characters ] : core/char.html
2574
2595
[ strings ] : core/str.html
2575
- [ `Option` ] : core/option.html
2576
- [ `Result` ] : core/result.html
2596
+ [ vectors ] : core/vec.html
2597
+ [ managed boxes ] : core/managed.html
2598
+ [ owned boxes ] : core/owned.html
2599
+ [ pointers ] : core/ptr.html
2600
+ [ `option` ] : core/option.html
2601
+ [ `result` ] : core/result.html
2602
+ [ task ] : core/task.html
2603
+ [ communication ] : core/comm.html
2604
+ [ `os` ] : core/os.html
2605
+ [ `path` ] : core/path.html
2606
+ [ `io` ] : core/io.html
2607
+ [ containers ] : core/container.html
2608
+ [ `hashmap` ] : core/hashmap.html
2609
+ [ `kinds` ] : core/kinds.html
2610
+ [ `ops` ] : core/ops.html
2611
+ [ `cmp` ] : core/cmp.html
2612
+ [ `num` ] : core/num.html
2613
+ [ `to_str` ] : core/to_str.html
2614
+ [ `clone` ] : core/clone.html
2615
+ [ `libc` ] : core/libc.html
2577
2616
2578
2617
# What next?
2579
2618
@@ -2585,10 +2624,7 @@ tutorials on individual topics.
2585
2624
* [ Macros] [ macros ]
2586
2625
* [ The foreign function interface] [ ffi ]
2587
2626
2588
- There is further documentation on the [ wiki] , including articles about
2589
- [ unit testing] in Rust, [ documenting] [ rustdoc ] and [ packaging] [ cargo ]
2590
- Rust code, and a discussion of the [ attributes] used to apply metadata
2591
- to code.
2627
+ There is further documentation on the [ wiki] .
2592
2628
2593
2629
[ borrow ] : tutorial-borrowed-ptr.html
2594
2630
[ tasks ] : tutorial-tasks.html
0 commit comments