官术网_书友最值得收藏!

Primitive types

Rust has the following built-in primitive types:

  • bool: These are the usual booleans and can be either true or false .
  • char: Characters, such as e.
  • Integer types: These are characterized by the bit width. Rust supports integers that are up to 128 bits wide:
  • isize: The pointer-sized signed integer type. Equivalent to i32 on 32-bit CPU and i64 on 64-bit CPU.
  • usize: The pointer-sized unsigned integer type. Equivalent to i32 on 32-bit CPU and i64 on 64-bit CPU.
  • f32: The 32-bit floating point type. Implements the IEEE 754 standard for floating point representation.
  • f64: The 64-bit floating point type.
  • [T; N]: A fixed-size array, for the element type, T, and the non-negative compile-time constant size N.
  • [T]: A dynamically-sized view into a contiguous sequence, for any type T.
  • str: String slices, mainly used as a reference, that is, &str.
  • (T, U, ..): A finite sequence, (T, U, ..) where T and U can be different types.
  • fn(i32) -> i32: A function that takes an i32 and returns an i32. Functions also have a type.
主站蜘蛛池模板: 镇沅| 霸州市| 无极县| 长子县| 红河县| 三河市| 普格县| 临澧县| 吉木乃县| 广丰县| 井陉县| 汨罗市| 芮城县| 靖宇县| 海伦市| 韩城市| 潢川县| 阳春市| 北安市| 康平县| 辉南县| 昌邑市| 石城县| 葵青区| 甘肃省| 乐陵市| 彭州市| 重庆市| 达尔| 南皮县| 勐海县| 嘉禾县| 岚皋县| 鸡西市| 塘沽区| 剑川县| 沭阳县| 新源县| 杭锦旗| 大邑县| 通化市|