Update generic.md

pull/1074/head
NeutronStarPRO 3 years ago committed by GitHub
parent 212526cd31
commit 0d821e603a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,6 +3,8 @@
Go 语言在 2022 年,就要正式引入泛型,被视为在 1.0 版本后语言特性发展迈出的一大步为什么泛型这么重要到底什么是泛型Rust 的泛型有几种? Go 语言在 2022 年,就要正式引入泛型,被视为在 1.0 版本后语言特性发展迈出的一大步为什么泛型这么重要到底什么是泛型Rust 的泛型有几种?
本章将一一为你讲解。 本章将一一为你讲解。
泛型即广泛的类型。
我们在编程中,经常有这样的需求:用同一功能的函数处理不同类型的数据,例如两个数的加法,无论是整数还是浮点数,甚至是自定义类型,都能进行支持。在不支持泛型的编程语言中,通常需要为每一种类型编写一个函数: 我们在编程中,经常有这样的需求:用同一功能的函数处理不同类型的数据,例如两个数的加法,无论是整数还是浮点数,甚至是自定义类型,都能进行支持。在不支持泛型的编程语言中,通常需要为每一种类型编写一个函数:
```rust ```rust
@ -470,4 +472,4 @@ fn main() {
> - [泛型](https://zh.practice.rs/generics-traits/generics.html) > - [泛型](https://zh.practice.rs/generics-traits/generics.html)
> - [习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/generics-traits/generics.md) > - [习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/generics-traits/generics.md)
> - [const 泛型](https://zh.practice.rs/generics-traits/const-generics.html) > - [const 泛型](https://zh.practice.rs/generics-traits/const-generics.html)
> - [习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/generics-traits/const-generics.md) > - [习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/generics-traits/const-generics.md)

Loading…
Cancel
Save