rustc 的提示也不错 [docs skip] [build skip]

This commit is contained in:
shenjack 2023-01-23 23:50:21 +08:00
parent a591ad9dbd
commit c9b2c7b14a

View File

@ -16,7 +16,6 @@ pub mod types {
use std::collections::HashMap; use std::collections::HashMap;
use pyo3::intern; use pyo3::intern;
use pyo3::prelude::*; use pyo3::prelude::*;
use pyo3::types::iter::PyDictIterator;
use pyo3::types::PyDict; use pyo3::types::PyDict;
pub struct SR1PartData { pub struct SR1PartData {
@ -51,7 +50,8 @@ pub mod types {
impl PartDatas { impl PartDatas {
#[new] #[new]
pub fn py_new(py_part_data: &PyDict) -> PyResult<Self>{ pub fn py_new(py_part_data: &PyDict) -> PyResult<Self>{
let mut let mut datas: HashMap<usize, SR1PartData> = HashMap::with_capacity(py_part_data.len());
return Ok(PartDatas{part_structs: datas})
} }
} }
@ -85,8 +85,9 @@ pub mod types {
pub fn point_dict_from_part_datas(input: &PyDict) -> Result<HashMap<usize, Point>, PyErr> { pub fn point_dict_from_part_datas(input: &PyDict) -> Result<HashMap<usize, Point>, PyErr> {
let mut result: HashMap<usize, Point> = HashMap::with_capacity(input.len()); let mut result: HashMap<usize, Point> = HashMap::with_capacity(input.len());
for key in &input.iter() { for key in input.iter() {
key[] println!("aaa");
// key[]
} }
return Ok(result); return Ok(result);
} }