mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-12 02:38:16 +08:00
Bug fixes and improvements (#1572)
* Sync zh and zh-hant versions. * Remove the polyfill.io link from mkdocs.yml * Update contributors' info for code reviewers and en/zh-hant versions reviewers. * Fix graph.md * Update avatars for English version reviewers. * Sync zh and zh-hant versions. * Fix two_sum_brute_force.png * Sync zh and zh-hant versions. Optimize structrue of index.html. * Format index.html
This commit is contained in:
21
zh-hant/codes/rust/src/include/vertex.rs
Normal file
21
zh-hant/codes/rust/src/include/vertex.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* File: vertex.rs
|
||||
* Created Time: 2023-07-13
|
||||
* Author: night-cruise (2586447362@qq.com)
|
||||
*/
|
||||
|
||||
/* 頂點型別 */
|
||||
#[derive(Copy, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct Vertex {
|
||||
pub val: i32,
|
||||
}
|
||||
|
||||
/* 輸入值串列 vals ,返回頂點串列 vets */
|
||||
pub fn vals_to_vets(vals: Vec<i32>) -> Vec<Vertex> {
|
||||
vals.into_iter().map(|val| Vertex { val }).collect()
|
||||
}
|
||||
|
||||
/* 輸入頂點串列 vets ,返回值串列 vals */
|
||||
pub fn vets_to_vals(vets: Vec<Vertex>) -> Vec<i32> {
|
||||
vets.into_iter().map(|vet| vet.val).collect()
|
||||
}
|
||||
Reference in New Issue
Block a user