08 2022 档案
摘要:let df = ctx.sql("SELECT distinct \"扫描人\" FROM example").await?;or let df = ctx.sql("SELECT distinct ‘扫描人’ FROM example").await?; => failed.
阅读全文
摘要:struct A<T:Clone>{ data: Vec<T> } type AA = A<usize>; type BB<'a> = A<&'a str>; impl<T:Clone> From<T> for A<T> { fn from(c: T) -> Self { A { data: vec
阅读全文
摘要:(val1 - val2).abs() < f64::EPSILON val1.to_ne_bytes() == val2.to_ne_bytes() 或者 val1.to_bits() == val2.to_bits()
阅读全文
摘要:use std::sync::{Arc, Mutex, Condvar}; use std::thread; use std::cell::RefCell; #[derive(Debug)] struct D{ name: RefCell<String>, data: Vec<i32> } #[de
阅读全文
摘要:Rc<T>/RefCell<T>用于单线程内部可变性, Arc<T>/Mutex<T>用于多线程内部可变性。
阅读全文
摘要:const DEST:(usize, usize) = (7,9); fn try_way(pre:(usize, usize), curr:(usize, usize), map:&[[i32;10];10], route:&mut Vec<(usize, usize)>){ let up:(us
阅读全文
摘要:一个简单的需求:读入一个目录内的所有文本文件,每个文件的格式都是每一行定义一个二维点,例如x=1,y=2;获取所有点的一个列表。这里不使用serde或者现成的parser库,这么简单的格式直接手写就行了 没有错误处理 先来一个糙快猛的版本。其中用了一个nightly feature str_spli
阅读全文
摘要:use std::cmp::Ordering; #[derive(Debug)] enum D{ F(f64) } fn getnum(s:&D) ->f64{ if let D::F(x) = s{ *x }else{ panic!("no value"); } } impl std::cmp::
阅读全文
摘要:rust web, salvo,
阅读全文
摘要:path = r'\\c价.xlsx' df = pd.read_excel(path) df = df.sort_values(by='YM', ascending=False) df.dropna(inplace=True) df['cc'] = np.where(df['单价'].str.is
阅读全文
摘要:use chrono::prelude::*; // 1. 时间转字符 // 2. 字符转时间 // 3. 时间相加减 // 4. 时间加差异数 fn main(){ let d = NaiveDate::from_ymd(2015, 3, 14); let a = NaiveDate::from_
阅读全文
摘要:use std::cmp::Ordering; enum Fruit { Apple(i32), Orange(i32), } fn process_fruit(_apple_prices: &[i32], _orange_prices: &[i32]) { // whatever we do to
阅读全文