]> git.lizzy.rs Git - rust.git/blob - src/libstd/primitive_docs.rs
Fix invalid associated type rendering in rustdoc
[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/first-edition/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 /// [`null`]: ../std/ptr/fn.null.html
259 /// [`is_null`]: ../std/primitive.pointer.html#method.is_null
260 /// [`offset`]: ../std/primitive.pointer.html#method.offset
261 /// [`into_raw`]: ../std/boxed/struct.Box.html#method.into_raw
262 /// [`drop`]: ../std/mem/fn.drop.html
263 #[stable(feature = "rust1", since = "1.0.0")]
264 mod prim_pointer { }
265
266 #[doc(primitive = "array")]
267 //
268 /// A fixed-size array, denoted `[T; N]`, for the element type, `T`, and the
269 /// non-negative compile-time constant size, `N`.
270 ///
271 /// There are two syntactic forms for creating an array:
272 ///
273 /// * A list with each element, i.e. `[x, y, z]`.
274 /// * A repeat expression `[x; N]`, which produces an array with `N` copies of `x`.
275 ///   The type of `x` must be [`Copy`][copy].
276 ///
277 /// Arrays of sizes from 0 to 32 (inclusive) implement the following traits if
278 /// the element type allows it:
279 ///
280 /// - [`Clone`][clone] (only if `T: [Copy][copy]`)
281 /// - [`Debug`][debug]
282 /// - [`IntoIterator`][intoiterator] (implemented for `&[T; N]` and `&mut [T; N]`)
283 /// - [`PartialEq`][partialeq], [`PartialOrd`][partialord], [`Eq`][eq], [`Ord`][ord]
284 /// - [`Hash`][hash]
285 /// - [`AsRef`][asref], [`AsMut`][asmut]
286 /// - [`Borrow`][borrow], [`BorrowMut`][borrowmut]
287 /// - [`Default`][default]
288 ///
289 /// This limitation on the size `N` exists because Rust does not yet support
290 /// code that is generic over the size of an array type. `[Foo; 3]` and `[Bar; 3]`
291 /// are instances of same generic type `[T; 3]`, but `[Foo; 3]` and `[Foo; 5]` are
292 /// entirely different types. As a stopgap, trait implementations are
293 /// statically generated up to size 32.
294 ///
295 /// Arrays of *any* size are [`Copy`][copy] if the element type is [`Copy`][copy]. This
296 /// works because the [`Copy`][copy] trait is specially known to the compiler.
297 ///
298 /// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on
299 /// an array. Indeed, this provides most of the API for working with arrays.
300 /// Slices have a dynamic size and do not coerce to arrays.
301 ///
302 /// There is no way to move elements out of an array. See [`mem::replace`][replace]
303 /// for an alternative.
304 ///
305 /// # Examples
306 ///
307 /// ```
308 /// let mut array: [i32; 3] = [0; 3];
309 ///
310 /// array[1] = 1;
311 /// array[2] = 2;
312 ///
313 /// assert_eq!([1, 2], &array[1..]);
314 ///
315 /// // This loop prints: 0 1 2
316 /// for x in &array {
317 ///     print!("{} ", x);
318 /// }
319 /// ```
320 ///
321 /// An array itself is not iterable:
322 ///
323 /// ```ignore
324 /// let array: [i32; 3] = [0; 3];
325 ///
326 /// for x in array { }
327 /// // error: the trait bound `[i32; 3]: std::iter::Iterator` is not satisfied
328 /// ```
329 ///
330 /// The solution is to coerce the array to a slice by calling a slice method:
331 ///
332 /// ```
333 /// # let array: [i32; 3] = [0; 3];
334 /// for x in array.iter() { }
335 /// ```
336 ///
337 /// If the array has 32 or fewer elements (see above), you can also use the
338 /// array reference's [`IntoIterator`] implementation:
339 ///
340 /// ```
341 /// # let array: [i32; 3] = [0; 3];
342 /// for x in &array { }
343 /// ```
344 ///
345 /// [slice]: primitive.slice.html
346 /// [copy]: marker/trait.Copy.html
347 /// [clone]: clone/trait.Clone.html
348 /// [debug]: fmt/trait.Debug.html
349 /// [intoiterator]: iter/trait.IntoIterator.html
350 /// [partialeq]: cmp/trait.PartialEq.html
351 /// [partialord]: cmp/trait.PartialOrd.html
352 /// [eq]: cmp/trait.Eq.html
353 /// [ord]: cmp/trait.Ord.html
354 /// [hash]: hash/trait.Hash.html
355 /// [asref]: convert/trait.AsRef.html
356 /// [asmut]: convert/trait.AsMut.html
357 /// [borrow]: borrow/trait.Borrow.html
358 /// [borrowmut]: borrow/trait.BorrowMut.html
359 /// [default]: default/trait.Default.html
360 /// [replace]: mem/fn.replace.html
361 /// [`IntoIterator`]: iter/trait.IntoIterator.html
362 ///
363 #[stable(feature = "rust1", since = "1.0.0")]
364 mod prim_array { }
365
366 #[doc(primitive = "slice")]
367 //
368 /// A dynamically-sized view into a contiguous sequence, `[T]`.
369 ///
370 /// Slices are a view into a block of memory represented as a pointer and a
371 /// length.
372 ///
373 /// ```
374 /// // slicing a Vec
375 /// let vec = vec![1, 2, 3];
376 /// let int_slice = &vec[..];
377 /// // coercing an array to a slice
378 /// let str_slice: &[&str] = &["one", "two", "three"];
379 /// ```
380 ///
381 /// Slices are either mutable or shared. The shared slice type is `&[T]`,
382 /// while the mutable slice type is `&mut [T]`, where `T` represents the element
383 /// type. For example, you can mutate the block of memory that a mutable slice
384 /// points to:
385 ///
386 /// ```
387 /// let x = &mut [1, 2, 3];
388 /// x[1] = 7;
389 /// assert_eq!(x, &[1, 7, 3]);
390 /// ```
391 ///
392 /// *[See also the `std::slice` module](slice/index.html).*
393 ///
394 #[stable(feature = "rust1", since = "1.0.0")]
395 mod prim_slice { }
396
397 #[doc(primitive = "str")]
398 //
399 /// String slices.
400 ///
401 /// The `str` type, also called a 'string slice', is the most primitive string
402 /// type. It is usually seen in its borrowed form, `&str`. It is also the type
403 /// of string literals, `&'static str`.
404 ///
405 /// Strings slices are always valid UTF-8.
406 ///
407 /// This documentation describes a number of methods and trait implementations
408 /// on the `str` type. For technical reasons, there is additional, separate
409 /// documentation in [the `std::str` module](str/index.html) as well.
410 ///
411 /// # Examples
412 ///
413 /// String literals are string slices:
414 ///
415 /// ```
416 /// let hello = "Hello, world!";
417 ///
418 /// // with an explicit type annotation
419 /// let hello: &'static str = "Hello, world!";
420 /// ```
421 ///
422 /// They are `'static` because they're stored directly in the final binary, and
423 /// so will be valid for the `'static` duration.
424 ///
425 /// # Representation
426 ///
427 /// A `&str` is made up of two components: a pointer to some bytes, and a
428 /// length. You can look at these with the [`.as_ptr`] and [`len`] methods:
429 ///
430 /// ```
431 /// use std::slice;
432 /// use std::str;
433 ///
434 /// let story = "Once upon a time...";
435 ///
436 /// let ptr = story.as_ptr();
437 /// let len = story.len();
438 ///
439 /// // story has nineteen bytes
440 /// assert_eq!(19, len);
441 ///
442 /// // We can re-build a str out of ptr and len. This is all unsafe because
443 /// // we are responsible for making sure the two components are valid:
444 /// let s = unsafe {
445 ///     // First, we build a &[u8]...
446 ///     let slice = slice::from_raw_parts(ptr, len);
447 ///
448 ///     // ... and then convert that slice into a string slice
449 ///     str::from_utf8(slice)
450 /// };
451 ///
452 /// assert_eq!(s, Ok(story));
453 /// ```
454 ///
455 /// [`.as_ptr`]: #method.as_ptr
456 /// [`len`]: #method.len
457 ///
458 /// Note: This example shows the internals of `&str`. `unsafe` should not be
459 /// used to get a string slice under normal circumstances. Use `.as_slice()`
460 /// instead.
461 #[stable(feature = "rust1", since = "1.0.0")]
462 mod prim_str { }
463
464 #[doc(primitive = "tuple")]
465 //
466 /// A finite heterogeneous sequence, `(T, U, ..)`.
467 ///
468 /// Let's cover each of those in turn:
469 ///
470 /// Tuples are *finite*. In other words, a tuple has a length. Here's a tuple
471 /// of length `3`:
472 ///
473 /// ```
474 /// ("hello", 5, 'c');
475 /// ```
476 ///
477 /// 'Length' is also sometimes called 'arity' here; each tuple of a different
478 /// length is a different, distinct type.
479 ///
480 /// Tuples are *heterogeneous*. This means that each element of the tuple can
481 /// have a different type. In that tuple above, it has the type:
482 ///
483 /// ```rust,ignore
484 /// (&'static str, i32, char)
485 /// ```
486 ///
487 /// Tuples are a *sequence*. This means that they can be accessed by position;
488 /// this is called 'tuple indexing', and it looks like this:
489 ///
490 /// ```rust
491 /// let tuple = ("hello", 5, 'c');
492 ///
493 /// assert_eq!(tuple.0, "hello");
494 /// assert_eq!(tuple.1, 5);
495 /// assert_eq!(tuple.2, 'c');
496 /// ```
497 ///
498 /// For more about tuples, see [the book](../book/first-edition/primitive-types.html#tuples).
499 ///
500 /// # Trait implementations
501 ///
502 /// If every type inside a tuple implements one of the following traits, then a
503 /// tuple itself also implements it.
504 ///
505 /// * [`Clone`]
506 /// * [`Copy`]
507 /// * [`PartialEq`]
508 /// * [`Eq`]
509 /// * [`PartialOrd`]
510 /// * [`Ord`]
511 /// * [`Debug`]
512 /// * [`Default`]
513 /// * [`Hash`]
514 ///
515 /// [`Clone`]: clone/trait.Clone.html
516 /// [`Copy`]: marker/trait.Copy.html
517 /// [`PartialEq`]: cmp/trait.PartialEq.html
518 /// [`Eq`]: cmp/trait.Eq.html
519 /// [`PartialOrd`]: cmp/trait.PartialOrd.html
520 /// [`Ord`]: cmp/trait.Ord.html
521 /// [`Debug`]: fmt/trait.Debug.html
522 /// [`Default`]: default/trait.Default.html
523 /// [`Hash`]: hash/trait.Hash.html
524 ///
525 /// Due to a temporary restriction in Rust's type system, these traits are only
526 /// implemented on tuples of arity 12 or less. In the future, this may change.
527 ///
528 /// # Examples
529 ///
530 /// Basic usage:
531 ///
532 /// ```
533 /// let tuple = ("hello", 5, 'c');
534 ///
535 /// assert_eq!(tuple.0, "hello");
536 /// ```
537 ///
538 /// Tuples are often used as a return type when you want to return more than
539 /// one value:
540 ///
541 /// ```
542 /// fn calculate_point() -> (i32, i32) {
543 ///     // Don't do a calculation, that's not the point of the example
544 ///     (4, 5)
545 /// }
546 ///
547 /// let point = calculate_point();
548 ///
549 /// assert_eq!(point.0, 4);
550 /// assert_eq!(point.1, 5);
551 ///
552 /// // Combining this with patterns can be nicer.
553 ///
554 /// let (x, y) = calculate_point();
555 ///
556 /// assert_eq!(x, 4);
557 /// assert_eq!(y, 5);
558 /// ```
559 ///
560 #[stable(feature = "rust1", since = "1.0.0")]
561 mod prim_tuple { }
562
563 #[doc(primitive = "f32")]
564 /// The 32-bit floating point type.
565 ///
566 /// *[See also the `std::f32` module](f32/index.html).*
567 ///
568 #[stable(feature = "rust1", since = "1.0.0")]
569 mod prim_f32 { }
570
571 #[doc(primitive = "f64")]
572 //
573 /// The 64-bit floating point type.
574 ///
575 /// *[See also the `std::f64` module](f64/index.html).*
576 ///
577 #[stable(feature = "rust1", since = "1.0.0")]
578 mod prim_f64 { }
579
580 #[doc(primitive = "i8")]
581 //
582 /// The 8-bit signed integer type.
583 ///
584 /// *[See also the `std::i8` module](i8/index.html).*
585 ///
586 /// However, please note that examples are shared between primitive integer
587 /// types. So it's normal if you see usage of types like `i64` in there.
588 ///
589 #[stable(feature = "rust1", since = "1.0.0")]
590 mod prim_i8 { }
591
592 #[doc(primitive = "i16")]
593 //
594 /// The 16-bit signed integer type.
595 ///
596 /// *[See also the `std::i16` module](i16/index.html).*
597 ///
598 /// However, please note that examples are shared between primitive integer
599 /// types. So it's normal if you see usage of types like `i32` in there.
600 ///
601 #[stable(feature = "rust1", since = "1.0.0")]
602 mod prim_i16 { }
603
604 #[doc(primitive = "i32")]
605 //
606 /// The 32-bit signed integer type.
607 ///
608 /// *[See also the `std::i32` module](i32/index.html).*
609 ///
610 /// However, please note that examples are shared between primitive integer
611 /// types. So it's normal if you see usage of types like `i16` in there.
612 ///
613 #[stable(feature = "rust1", since = "1.0.0")]
614 mod prim_i32 { }
615
616 #[doc(primitive = "i64")]
617 //
618 /// The 64-bit signed integer type.
619 ///
620 /// *[See also the `std::i64` module](i64/index.html).*
621 ///
622 /// However, please note that examples are shared between primitive integer
623 /// types. So it's normal if you see usage of types like `i8` in there.
624 ///
625 #[stable(feature = "rust1", since = "1.0.0")]
626 mod prim_i64 { }
627
628 #[doc(primitive = "i128")]
629 //
630 /// The 128-bit signed integer type.
631 ///
632 /// *[See also the `std::i128` module](i128/index.html).*
633 ///
634 /// However, please note that examples are shared between primitive integer
635 /// types. So it's normal if you see usage of types like `i8` in there.
636 ///
637 #[unstable(feature = "i128", issue="35118")]
638 mod prim_i128 { }
639
640 #[doc(primitive = "u8")]
641 //
642 /// The 8-bit unsigned integer type.
643 ///
644 /// *[See also the `std::u8` module](u8/index.html).*
645 ///
646 /// However, please note that examples are shared between primitive integer
647 /// types. So it's normal if you see usage of types like `u64` in there.
648 ///
649 #[stable(feature = "rust1", since = "1.0.0")]
650 mod prim_u8 { }
651
652 #[doc(primitive = "u16")]
653 //
654 /// The 16-bit unsigned integer type.
655 ///
656 /// *[See also the `std::u16` module](u16/index.html).*
657 ///
658 /// However, please note that examples are shared between primitive integer
659 /// types. So it's normal if you see usage of types like `u32` in there.
660 ///
661 #[stable(feature = "rust1", since = "1.0.0")]
662 mod prim_u16 { }
663
664 #[doc(primitive = "u32")]
665 //
666 /// The 32-bit unsigned integer type.
667 ///
668 /// *[See also the `std::u32` module](u32/index.html).*
669 ///
670 /// However, please note that examples are shared between primitive integer
671 /// types. So it's normal if you see usage of types like `u16` in there.
672 ///
673 #[stable(feature = "rust1", since = "1.0.0")]
674 mod prim_u32 { }
675
676 #[doc(primitive = "u64")]
677 //
678 /// The 64-bit unsigned integer type.
679 ///
680 /// *[See also the `std::u64` module](u64/index.html).*
681 ///
682 /// However, please note that examples are shared between primitive integer
683 /// types. So it's normal if you see usage of types like `u8` in there.
684 ///
685 #[stable(feature = "rust1", since = "1.0.0")]
686 mod prim_u64 { }
687
688 #[doc(primitive = "u128")]
689 //
690 /// The 128-bit unsigned integer type.
691 ///
692 /// *[See also the `std::u128` module](u128/index.html).*
693 ///
694 /// However, please note that examples are shared between primitive integer
695 /// types. So it's normal if you see usage of types like `u8` in there.
696 ///
697 #[unstable(feature = "i128", issue="35118")]
698 mod prim_u128 { }
699
700 #[doc(primitive = "isize")]
701 //
702 /// The pointer-sized signed integer type.
703 ///
704 /// *[See also the `std::isize` module](isize/index.html).*
705 ///
706 /// However, please note that examples are shared between primitive integer
707 /// types. So it's normal if you see usage of types like `usize` in there.
708 ///
709 #[stable(feature = "rust1", since = "1.0.0")]
710 mod prim_isize { }
711
712 #[doc(primitive = "usize")]
713 //
714 /// The pointer-sized unsigned integer type.
715 ///
716 /// *[See also the `std::usize` module](usize/index.html).*
717 ///
718 /// However, please note that examples are shared between primitive integer
719 /// types. So it's normal if you see usage of types like `isize` in there.
720 ///
721 #[stable(feature = "rust1", since = "1.0.0")]
722 mod prim_usize { }