]> git.lizzy.rs Git - rust.git/blob - src/libstd/primitive_docs.rs
Rollup merge of #40521 - TimNN:panic-free-shift, r=alexcrichton
[rust.git] / src / libstd / primitive_docs.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #[doc(primitive = "bool")]
12 //
13 /// The boolean type.
14 ///
15 /// The `bool` represents a value, which could only be either `true` or `false`. If you cast
16 /// a `bool` into an integer, `true` will be 1 and `false` will be 0.
17 ///
18 /// # Basic usage
19 ///
20 /// `bool` implements various traits, such as [`BitAnd`], [`BitOr`], [`Not`], etc.,
21 /// which allow us to perform boolean operations using `&`, `|` and `!`.
22 ///
23 /// [`if`] always demands a `bool` value. [`assert!`], being an important macro in testing,
24 /// checks whether an expression returns `true`.
25 ///
26 /// ```
27 /// let bool_val = true & false | false;
28 /// assert!(!bool_val);
29 /// ```
30 ///
31 /// [`assert!`]: macro.assert.html
32 /// [`if`]: ../book/if.html
33 /// [`BitAnd`]: ops/trait.BitAnd.html
34 /// [`BitOr`]: ops/trait.BitOr.html
35 /// [`Not`]: ops/trait.Not.html
36 ///
37 /// # Examples
38 ///
39 /// A trivial example of the usage of `bool`,
40 ///
41 /// ```
42 /// let praise_the_borrow_checker = true;
43 ///
44 /// // using the `if` conditional
45 /// if praise_the_borrow_checker {
46 ///     println!("oh, yeah!");
47 /// } else {
48 ///     println!("what?!!");
49 /// }
50 ///
51 /// // ... or, a match pattern
52 /// match praise_the_borrow_checker {
53 ///     true => println!("keep praising!"),
54 ///     false => println!("you should praise!"),
55 /// }
56 /// ```
57 ///
58 /// Also, since `bool` implements the [`Copy`](marker/trait.Copy.html) trait, we don't
59 /// have to worry about the move semantics (just like the integer and float primitives).
60 ///
61 /// Now an example of `bool` cast to integer type:
62 ///
63 /// ```
64 /// assert_eq!(true as i32, 1);
65 /// assert_eq!(false as i32, 0);
66 /// ```
67 #[stable(feature = "rust1", since = "1.0.0")]
68 mod prim_bool { }
69
70 #[doc(primitive = "char")]
71 //
72 /// A character type.
73 ///
74 /// The `char` type represents a single character. More specifically, since
75 /// 'character' isn't a well-defined concept in Unicode, `char` is a '[Unicode
76 /// scalar value]', which is similar to, but not the same as, a '[Unicode code
77 /// point]'.
78 ///
79 /// [Unicode scalar value]: http://www.unicode.org/glossary/#unicode_scalar_value
80 /// [Unicode code point]: http://www.unicode.org/glossary/#code_point
81 ///
82 /// This documentation describes a number of methods and trait implementations on the
83 /// `char` type. For technical reasons, there is additional, separate
84 /// documentation in [the `std::char` module](char/index.html) as well.
85 ///
86 /// # Representation
87 ///
88 /// `char` is always four bytes in size. This is a different representation than
89 /// a given character would have as part of a [`String`]. For example:
90 ///
91 /// ```
92 /// let v = vec!['h', 'e', 'l', 'l', 'o'];
93 ///
94 /// // five elements times four bytes for each element
95 /// assert_eq!(20, v.len() * std::mem::size_of::<char>());
96 ///
97 /// let s = String::from("hello");
98 ///
99 /// // five elements times one byte per element
100 /// assert_eq!(5, s.len() * std::mem::size_of::<u8>());
101 /// ```
102 ///
103 /// [`String`]: string/struct.String.html
104 ///
105 /// As always, remember that a human intuition for 'character' may not map to
106 /// Unicode's definitions. For example, emoji symbols such as '❤️' can be more
107 /// than one Unicode code point; this ❤️ in particular is two:
108 ///
109 /// ```
110 /// let s = String::from("❤️");
111 ///
112 /// // we get two chars out of a single ❤️
113 /// let mut iter = s.chars();
114 /// assert_eq!(Some('\u{2764}'), iter.next());
115 /// assert_eq!(Some('\u{fe0f}'), iter.next());
116 /// assert_eq!(None, iter.next());
117 /// ```
118 ///
119 /// This means it won't fit into a `char`. Trying to create a literal with
120 /// `let heart = '❤️';` gives an error:
121 ///
122 /// ```text
123 /// error: character literal may only contain one codepoint: '❤
124 /// let heart = '❤️';
125 ///             ^~
126 /// ```
127 ///
128 /// Another implication of the 4-byte fixed size of a `char` is that
129 /// per-`char` processing can end up using a lot more memory:
130 ///
131 /// ```
132 /// let s = String::from("love: ❤️");
133 /// let v: Vec<char> = s.chars().collect();
134 ///
135 /// assert_eq!(12, s.len() * std::mem::size_of::<u8>());
136 /// assert_eq!(32, v.len() * std::mem::size_of::<char>());
137 /// ```
138 #[stable(feature = "rust1", since = "1.0.0")]
139 mod prim_char { }
140
141 #[doc(primitive = "unit")]
142 //
143 /// The `()` type, sometimes called "unit" or "nil".
144 ///
145 /// The `()` type has exactly one value `()`, and is used when there
146 /// is no other meaningful value that could be returned. `()` is most
147 /// commonly seen implicitly: functions without a `-> ...` implicitly
148 /// have return type `()`, that is, these are equivalent:
149 ///
150 /// ```rust
151 /// fn long() -> () {}
152 ///
153 /// fn short() {}
154 /// ```
155 ///
156 /// The semicolon `;` can be used to discard the result of an
157 /// expression at the end of a block, making the expression (and thus
158 /// the block) evaluate to `()`. For example,
159 ///
160 /// ```rust
161 /// fn returns_i64() -> i64 {
162 ///     1i64
163 /// }
164 /// fn returns_unit() {
165 ///     1i64;
166 /// }
167 ///
168 /// let is_i64 = {
169 ///     returns_i64()
170 /// };
171 /// let is_unit = {
172 ///     returns_i64();
173 /// };
174 /// ```
175 ///
176 #[stable(feature = "rust1", since = "1.0.0")]
177 mod prim_unit { }
178
179 #[doc(primitive = "pointer")]
180 //
181 /// Raw, unsafe pointers, `*const T`, and `*mut T`.
182 ///
183 /// Working with raw pointers in Rust is uncommon,
184 /// typically limited to a few patterns.
185 ///
186 /// Use the `null` function to create null pointers, and the `is_null` method
187 /// of the `*const T` type  to check for null. The `*const T` type also defines
188 /// the `offset` method, for pointer math.
189 ///
190 /// # Common ways to create raw pointers
191 ///
192 /// ## 1. Coerce a reference (`&T`) or mutable reference (`&mut T`).
193 ///
194 /// ```
195 /// let my_num: i32 = 10;
196 /// let my_num_ptr: *const i32 = &my_num;
197 /// let mut my_speed: i32 = 88;
198 /// let my_speed_ptr: *mut i32 = &mut my_speed;
199 /// ```
200 ///
201 /// To get a pointer to a boxed value, dereference the box:
202 ///
203 /// ```
204 /// let my_num: Box<i32> = Box::new(10);
205 /// let my_num_ptr: *const i32 = &*my_num;
206 /// let mut my_speed: Box<i32> = Box::new(88);
207 /// let my_speed_ptr: *mut i32 = &mut *my_speed;
208 /// ```
209 ///
210 /// This does not take ownership of the original allocation
211 /// and requires no resource management later,
212 /// but you must not use the pointer after its lifetime.
213 ///
214 /// ## 2. Consume a box (`Box<T>`).
215 ///
216 /// The `into_raw` function consumes a box and returns
217 /// the raw pointer. It doesn't destroy `T` or deallocate any memory.
218 ///
219 /// ```
220 /// let my_speed: Box<i32> = Box::new(88);
221 /// let my_speed: *mut i32 = Box::into_raw(my_speed);
222 ///
223 /// // By taking ownership of the original `Box<T>` though
224 /// // we are obligated to put it together later to be destroyed.
225 /// unsafe {
226 ///     drop(Box::from_raw(my_speed));
227 /// }
228 /// ```
229 ///
230 /// Note that here the call to `drop` is for clarity - it indicates
231 /// that we are done with the given value and it should be destroyed.
232 ///
233 /// ## 3. Get it from C.
234 ///
235 /// ```
236 /// # #![feature(libc)]
237 /// extern crate libc;
238 ///
239 /// use std::mem;
240 ///
241 /// fn main() {
242 ///     unsafe {
243 ///         let my_num: *mut i32 = libc::malloc(mem::size_of::<i32>()) as *mut i32;
244 ///         if my_num.is_null() {
245 ///             panic!("failed to allocate memory");
246 ///         }
247 ///         libc::free(my_num as *mut libc::c_void);
248 ///     }
249 /// }
250 /// ```
251 ///
252 /// Usually you wouldn't literally use `malloc` and `free` from Rust,
253 /// but C APIs hand out a lot of pointers generally, so are a common source
254 /// of raw pointers in Rust.
255 ///
256 /// *[See also the `std::ptr` module](ptr/index.html).*
257 ///
258 #[stable(feature = "rust1", since = "1.0.0")]
259 mod prim_pointer { }
260
261 #[doc(primitive = "array")]
262 //
263 /// A fixed-size array, denoted `[T; N]`, for the element type, `T`, and the
264 /// non-negative compile-time constant size, `N`.
265 ///
266 /// There are two syntactic forms for creating an array:
267 ///
268 /// * A list with each element, i.e. `[x, y, z]`.
269 /// * A repeat expression `[x; N]`, which produces an array with `N` copies of `x`.
270 ///   The type of `x` must be [`Copy`][copy].
271 ///
272 /// Arrays of sizes from 0 to 32 (inclusive) implement the following traits if
273 /// the element type allows it:
274 ///
275 /// - [`Clone`][clone] (only if `T: [Copy][copy]`)
276 /// - [`Debug`][debug]
277 /// - [`IntoIterator`][intoiterator] (implemented for `&[T; N]` and `&mut [T; N]`)
278 /// - [`PartialEq`][partialeq], [`PartialOrd`][partialord], [`Eq`][eq], [`Ord`][ord]
279 /// - [`Hash`][hash]
280 /// - [`AsRef`][asref], [`AsMut`][asmut]
281 /// - [`Borrow`][borrow], [`BorrowMut`][borrowmut]
282 /// - [`Default`][default]
283 ///
284 /// This limitation on the size `N` exists because Rust does not yet support
285 /// code that is generic over the size of an array type. `[Foo; 3]` and `[Bar; 3]`
286 /// are instances of same generic type `[T; 3]`, but `[Foo; 3]` and `[Foo; 5]` are
287 /// entirely different types. As a stopgap, trait implementations are
288 /// statically generated up to size 32.
289 ///
290 /// Arrays of *any* size are [`Copy`][copy] if the element type is [`Copy`][copy]. This
291 /// works because the [`Copy`][copy] trait is specially known to the compiler.
292 ///
293 /// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on
294 /// an array. Indeed, this provides most of the API for working with arrays.
295 /// Slices have a dynamic size and do not coerce to arrays.
296 ///
297 /// There is no way to move elements out of an array. See [`mem::replace`][replace]
298 /// for an alternative.
299 ///
300 /// # Examples
301 ///
302 /// ```
303 /// let mut array: [i32; 3] = [0; 3];
304 ///
305 /// array[1] = 1;
306 /// array[2] = 2;
307 ///
308 /// assert_eq!([1, 2], &array[1..]);
309 ///
310 /// // This loop prints: 0 1 2
311 /// for x in &array {
312 ///     print!("{} ", x);
313 /// }
314 /// ```
315 ///
316 /// An array itself is not iterable:
317 ///
318 /// ```ignore
319 /// let array: [i32; 3] = [0; 3];
320 ///
321 /// for x in array { }
322 /// // error: the trait bound `[i32; 3]: std::iter::Iterator` is not satisfied
323 /// ```
324 ///
325 /// The solution is to coerce the array to a slice by calling a slice method:
326 ///
327 /// ```
328 /// # let array: [i32; 3] = [0; 3];
329 /// for x in array.iter() { }
330 /// ```
331 ///
332 /// If the array has 32 or fewer elements (see above), you can also use the
333 /// array reference's [`IntoIterator`] implementation:
334 ///
335 /// ```
336 /// # let array: [i32; 3] = [0; 3];
337 /// for x in &array { }
338 /// ```
339 ///
340 /// [slice]: primitive.slice.html
341 /// [copy]: marker/trait.Copy.html
342 /// [clone]: clone/trait.Clone.html
343 /// [debug]: fmt/trait.Debug.html
344 /// [intoiterator]: iter/trait.IntoIterator.html
345 /// [partialeq]: cmp/trait.PartialEq.html
346 /// [partialord]: cmp/trait.PartialOrd.html
347 /// [eq]: cmp/trait.Eq.html
348 /// [ord]: cmp/trait.Ord.html
349 /// [hash]: hash/trait.Hash.html
350 /// [asref]: convert/trait.AsRef.html
351 /// [asmut]: convert/trait.AsMut.html
352 /// [borrow]: borrow/trait.Borrow.html
353 /// [borrowmut]: borrow/trait.BorrowMut.html
354 /// [default]: default/trait.Default.html
355 /// [replace]: mem/fn.replace.html
356 /// [`IntoIterator`]: iter/trait.IntoIterator.html
357 ///
358 #[stable(feature = "rust1", since = "1.0.0")]
359 mod prim_array { }
360
361 #[doc(primitive = "slice")]
362 //
363 /// A dynamically-sized view into a contiguous sequence, `[T]`.
364 ///
365 /// Slices are a view into a block of memory represented as a pointer and a
366 /// length.
367 ///
368 /// ```
369 /// // slicing a Vec
370 /// let vec = vec![1, 2, 3];
371 /// let int_slice = &vec[..];
372 /// // coercing an array to a slice
373 /// let str_slice: &[&str] = &["one", "two", "three"];
374 /// ```
375 ///
376 /// Slices are either mutable or shared. The shared slice type is `&[T]`,
377 /// while the mutable slice type is `&mut [T]`, where `T` represents the element
378 /// type. For example, you can mutate the block of memory that a mutable slice
379 /// points to:
380 ///
381 /// ```
382 /// let x = &mut [1, 2, 3];
383 /// x[1] = 7;
384 /// assert_eq!(x, &[1, 7, 3]);
385 /// ```
386 ///
387 /// *[See also the `std::slice` module](slice/index.html).*
388 ///
389 #[stable(feature = "rust1", since = "1.0.0")]
390 mod prim_slice { }
391
392 #[doc(primitive = "str")]
393 //
394 /// String slices.
395 ///
396 /// The `str` type, also called a 'string slice', is the most primitive string
397 /// type. It is usually seen in its borrowed form, `&str`. It is also the type
398 /// of string literals, `&'static str`.
399 ///
400 /// Strings slices are always valid UTF-8.
401 ///
402 /// This documentation describes a number of methods and trait implementations
403 /// on the `str` type. For technical reasons, there is additional, separate
404 /// documentation in [the `std::str` module](str/index.html) as well.
405 ///
406 /// # Examples
407 ///
408 /// String literals are string slices:
409 ///
410 /// ```
411 /// let hello = "Hello, world!";
412 ///
413 /// // with an explicit type annotation
414 /// let hello: &'static str = "Hello, world!";
415 /// ```
416 ///
417 /// They are `'static` because they're stored directly in the final binary, and
418 /// so will be valid for the `'static` duration.
419 ///
420 /// # Representation
421 ///
422 /// A `&str` is made up of two components: a pointer to some bytes, and a
423 /// length. You can look at these with the [`.as_ptr`] and [`len`] methods:
424 ///
425 /// ```
426 /// use std::slice;
427 /// use std::str;
428 ///
429 /// let story = "Once upon a time...";
430 ///
431 /// let ptr = story.as_ptr();
432 /// let len = story.len();
433 ///
434 /// // story has nineteen bytes
435 /// assert_eq!(19, len);
436 ///
437 /// // We can re-build a str out of ptr and len. This is all unsafe because
438 /// // we are responsible for making sure the two components are valid:
439 /// let s = unsafe {
440 ///     // First, we build a &[u8]...
441 ///     let slice = slice::from_raw_parts(ptr, len);
442 ///
443 ///     // ... and then convert that slice into a string slice
444 ///     str::from_utf8(slice)
445 /// };
446 ///
447 /// assert_eq!(s, Ok(story));
448 /// ```
449 ///
450 /// [`.as_ptr`]: #method.as_ptr
451 /// [`len`]: #method.len
452 ///
453 /// Note: This example shows the internals of `&str`. `unsafe` should not be
454 /// used to get a string slice under normal circumstances. Use `.as_slice()`
455 /// instead.
456 #[stable(feature = "rust1", since = "1.0.0")]
457 mod prim_str { }
458
459 #[doc(primitive = "tuple")]
460 //
461 /// A finite heterogeneous sequence, `(T, U, ..)`.
462 ///
463 /// Let's cover each of those in turn:
464 ///
465 /// Tuples are *finite*. In other words, a tuple has a length. Here's a tuple
466 /// of length `3`:
467 ///
468 /// ```
469 /// ("hello", 5, 'c');
470 /// ```
471 ///
472 /// 'Length' is also sometimes called 'arity' here; each tuple of a different
473 /// length is a different, distinct type.
474 ///
475 /// Tuples are *heterogeneous*. This means that each element of the tuple can
476 /// have a different type. In that tuple above, it has the type:
477 ///
478 /// ```rust,ignore
479 /// (&'static str, i32, char)
480 /// ```
481 ///
482 /// Tuples are a *sequence*. This means that they can be accessed by position;
483 /// this is called 'tuple indexing', and it looks like this:
484 ///
485 /// ```rust
486 /// let tuple = ("hello", 5, 'c');
487 ///
488 /// assert_eq!(tuple.0, "hello");
489 /// assert_eq!(tuple.1, 5);
490 /// assert_eq!(tuple.2, 'c');
491 /// ```
492 ///
493 /// For more about tuples, see [the book](../book/primitive-types.html#tuples).
494 ///
495 /// # Trait implementations
496 ///
497 /// If every type inside a tuple implements one of the following traits, then a
498 /// tuple itself also implements it.
499 ///
500 /// * [`Clone`]
501 /// * [`Copy`]
502 /// * [`PartialEq`]
503 /// * [`Eq`]
504 /// * [`PartialOrd`]
505 /// * [`Ord`]
506 /// * [`Debug`]
507 /// * [`Default`]
508 /// * [`Hash`]
509 ///
510 /// [`Clone`]: clone/trait.Clone.html
511 /// [`Copy`]: marker/trait.Copy.html
512 /// [`PartialEq`]: cmp/trait.PartialEq.html
513 /// [`Eq`]: cmp/trait.Eq.html
514 /// [`PartialOrd`]: cmp/trait.PartialOrd.html
515 /// [`Ord`]: cmp/trait.Ord.html
516 /// [`Debug`]: fmt/trait.Debug.html
517 /// [`Default`]: default/trait.Default.html
518 /// [`Hash`]: hash/trait.Hash.html
519 ///
520 /// Due to a temporary restriction in Rust's type system, these traits are only
521 /// implemented on tuples of arity 12 or less. In the future, this may change.
522 ///
523 /// # Examples
524 ///
525 /// Basic usage:
526 ///
527 /// ```
528 /// let tuple = ("hello", 5, 'c');
529 ///
530 /// assert_eq!(tuple.0, "hello");
531 /// ```
532 ///
533 /// Tuples are often used as a return type when you want to return more than
534 /// one value:
535 ///
536 /// ```
537 /// fn calculate_point() -> (i32, i32) {
538 ///     // Don't do a calculation, that's not the point of the example
539 ///     (4, 5)
540 /// }
541 ///
542 /// let point = calculate_point();
543 ///
544 /// assert_eq!(point.0, 4);
545 /// assert_eq!(point.1, 5);
546 ///
547 /// // Combining this with patterns can be nicer.
548 ///
549 /// let (x, y) = calculate_point();
550 ///
551 /// assert_eq!(x, 4);
552 /// assert_eq!(y, 5);
553 /// ```
554 ///
555 #[stable(feature = "rust1", since = "1.0.0")]
556 mod prim_tuple { }
557
558 #[doc(primitive = "f32")]
559 /// The 32-bit floating point type.
560 ///
561 /// *[See also the `std::f32` module](f32/index.html).*
562 ///
563 #[stable(feature = "rust1", since = "1.0.0")]
564 mod prim_f32 { }
565
566 #[doc(primitive = "f64")]
567 //
568 /// The 64-bit floating point type.
569 ///
570 /// *[See also the `std::f64` module](f64/index.html).*
571 ///
572 #[stable(feature = "rust1", since = "1.0.0")]
573 mod prim_f64 { }
574
575 #[doc(primitive = "i8")]
576 //
577 /// The 8-bit signed integer type.
578 ///
579 /// *[See also the `std::i8` module](i8/index.html).*
580 ///
581 /// However, please note that examples are shared between primitive integer
582 /// types. So it's normal if you see usage of types like `i64` in there.
583 ///
584 #[stable(feature = "rust1", since = "1.0.0")]
585 mod prim_i8 { }
586
587 #[doc(primitive = "i16")]
588 //
589 /// The 16-bit signed integer type.
590 ///
591 /// *[See also the `std::i16` module](i16/index.html).*
592 ///
593 /// However, please note that examples are shared between primitive integer
594 /// types. So it's normal if you see usage of types like `i32` in there.
595 ///
596 #[stable(feature = "rust1", since = "1.0.0")]
597 mod prim_i16 { }
598
599 #[doc(primitive = "i32")]
600 //
601 /// The 32-bit signed integer type.
602 ///
603 /// *[See also the `std::i32` module](i32/index.html).*
604 ///
605 /// However, please note that examples are shared between primitive integer
606 /// types. So it's normal if you see usage of types like `i16` in there.
607 ///
608 #[stable(feature = "rust1", since = "1.0.0")]
609 mod prim_i32 { }
610
611 #[doc(primitive = "i64")]
612 //
613 /// The 64-bit signed integer type.
614 ///
615 /// *[See also the `std::i64` module](i64/index.html).*
616 ///
617 /// However, please note that examples are shared between primitive integer
618 /// types. So it's normal if you see usage of types like `i8` in there.
619 ///
620 #[stable(feature = "rust1", since = "1.0.0")]
621 mod prim_i64 { }
622
623 #[doc(primitive = "i128")]
624 //
625 /// The 128-bit signed integer type.
626 ///
627 /// *[See also the `std::i128` module](i128/index.html).*
628 ///
629 /// However, please note that examples are shared between primitive integer
630 /// types. So it's normal if you see usage of types like `i8` in there.
631 ///
632 #[unstable(feature = "i128", issue="35118")]
633 mod prim_i128 { }
634
635 #[doc(primitive = "u8")]
636 //
637 /// The 8-bit unsigned integer type.
638 ///
639 /// *[See also the `std::u8` module](u8/index.html).*
640 ///
641 /// However, please note that examples are shared between primitive integer
642 /// types. So it's normal if you see usage of types like `u64` in there.
643 ///
644 #[stable(feature = "rust1", since = "1.0.0")]
645 mod prim_u8 { }
646
647 #[doc(primitive = "u16")]
648 //
649 /// The 16-bit unsigned integer type.
650 ///
651 /// *[See also the `std::u16` module](u16/index.html).*
652 ///
653 /// However, please note that examples are shared between primitive integer
654 /// types. So it's normal if you see usage of types like `u32` in there.
655 ///
656 #[stable(feature = "rust1", since = "1.0.0")]
657 mod prim_u16 { }
658
659 #[doc(primitive = "u32")]
660 //
661 /// The 32-bit unsigned integer type.
662 ///
663 /// *[See also the `std::u32` module](u32/index.html).*
664 ///
665 /// However, please note that examples are shared between primitive integer
666 /// types. So it's normal if you see usage of types like `u16` in there.
667 ///
668 #[stable(feature = "rust1", since = "1.0.0")]
669 mod prim_u32 { }
670
671 #[doc(primitive = "u64")]
672 //
673 /// The 64-bit unsigned integer type.
674 ///
675 /// *[See also the `std::u64` module](u64/index.html).*
676 ///
677 /// However, please note that examples are shared between primitive integer
678 /// types. So it's normal if you see usage of types like `u8` in there.
679 ///
680 #[stable(feature = "rust1", since = "1.0.0")]
681 mod prim_u64 { }
682
683 #[doc(primitive = "u128")]
684 //
685 /// The 128-bit unsigned integer type.
686 ///
687 /// *[See also the `std::u128` module](u128/index.html).*
688 ///
689 /// However, please note that examples are shared between primitive integer
690 /// types. So it's normal if you see usage of types like `u8` in there.
691 ///
692 #[unstable(feature = "i128", issue="35118")]
693 mod prim_u128 { }
694
695 #[doc(primitive = "isize")]
696 //
697 /// The pointer-sized signed integer type.
698 ///
699 /// *[See also the `std::isize` module](isize/index.html).*
700 ///
701 /// However, please note that examples are shared between primitive integer
702 /// types. So it's normal if you see usage of types like `usize` in there.
703 ///
704 #[stable(feature = "rust1", since = "1.0.0")]
705 mod prim_isize { }
706
707 #[doc(primitive = "usize")]
708 //
709 /// The pointer-sized unsigned integer type.
710 ///
711 /// *[See also the `std::usize` module](usize/index.html).*
712 ///
713 /// However, please note that examples are shared between primitive integer
714 /// types. So it's normal if you see usage of types like `isize` in there.
715 ///
716 #[stable(feature = "rust1", since = "1.0.0")]
717 mod prim_usize { }