/
githubmirror
/
hello-algo
Обзор
Документация
Войти
/
githubmirror
/
hello-algo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
en/codes/rust/src/include/vertex.rs
27 строк
621 B
Yudong Jin
Translate all code to English (#1836)
31 дек 2025, 02:44
Не верифицирован
31 дек 2025, 02:44
2778a6f
Код
Авторство
О чём код?
/* * File: vertex.rs * Created Time: 2023-07-13 * Author: night-cruise (2586447362@qq.com) */ /* Vertex type */ #[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct Vertex { pub val: i32, } impl From<i32> for Vertex { fn from(value: i32) -> Self { Self { val: value } } } /* Input value list vals, return vertex list vets */ pub fn vals_to_vets(vals: Vec<i32>) -> Vec<Vertex> { vals.into_iter().map(|val| val.into()).collect() } /* Input vertex list vets, return value list vals */ pub fn vets_to_vals(vets: Vec<Vertex>) -> Vec<i32> { vets.into_iter().map(|vet| vet.val).collect() }