随笔分类 -  rust

摘要:use arrow_odbc::{odbc_api::Environment, OdbcReader}; const CONNECTION_STRING: &str = "Driver={PostgreSQL ANSI(x64)}; Server=127.0.0.1;Port=5433; UID=p 阅读全文
posted @ 2022-09-30 16:33 CrossPython 阅读(34) 评论(0) 推荐(0)
摘要:下载地址: https://www.postgresql.org/ftp/odbc/versions/msi/ 连接字符串,一般的结构是: Driver={PostgreSQL ODBC Driver(UNICODE)};server=127.0.0.1;port=5432;database=数据库 阅读全文
posted @ 2022-09-30 16:21 CrossPython 阅读(2221) 评论(0) 推荐(0)
摘要:extern crate r2d2; use std::{thread, io::Read}; use r2d2_postgres::{postgres::{NoTls, GenericClient, SimpleQueryRow, SimpleQueryMessage}, PostgresConn 阅读全文
posted @ 2022-09-30 16:04 CrossPython 阅读(58) 评论(0) 推荐(0)
摘要:#[tokio::main] async fn main()->Result<()> { let m = read_excel("abc.xlsx", 1, "Sheet1").unwrap(); let ctx = SessionContext::new(); ctx.register_table 阅读全文
posted @ 2022-09-30 10:41 CrossPython 阅读(17) 评论(0) 推荐(0)
摘要:// // // // 字符串 // let mut sbuilder = StringBuilder::new(100); // sbuilder.append_value("a").unwrap(); // sbuilder.append_null().unwrap(); // sbuilder 阅读全文
posted @ 2022-09-29 19:29 CrossPython 阅读(12) 评论(0) 推荐(0)
摘要:// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this 阅读全文
posted @ 2022-09-28 17:22 CrossPython 阅读(15) 评论(0) 推荐(0)
摘要:use std::str; fn main() { // 起始:Vec let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}']; // 从 Vec 转换为String let string1: String = src1.ite 阅读全文
posted @ 2022-09-27 14:10 CrossPython 阅读(455) 评论(0) 推荐(0)
摘要:extern crate tokio; pub mod datatable; pub mod handle_error; pub mod common; use chrono::prelude::*; use chrono::offset::LocalResult; use datafusion:: 阅读全文
posted @ 2022-09-26 16:11 CrossPython 阅读(26) 评论(0) 推荐(0)
摘要:use std::sync::Arc; use datafusion::arrow::datatypes::{ DataType, Field, Schema}; use datafusion::arrow::record_batch::RecordBatch; use datafusion::ar 阅读全文
posted @ 2022-09-15 20:27 CrossPython 阅读(34) 评论(0) 推荐(0)
摘要:extern crate arrow; extern crate tokio; use std::convert::TryFrom; use std::sync::Arc; // use arrow::array::{Float64Array, Int64Array, Date32Array, Da 阅读全文
posted @ 2022-09-15 20:27 CrossPython 阅读(18) 评论(0) 推荐(0)
摘要:布署 这是我的目录结构: . ├── Cargo.lock ├── Cargo.toml ├── code.md ├── diesel.toml ├── .env ├── migrations ├── README.md ├── src ├── static └── target 使用cargo r 阅读全文
posted @ 2022-09-09 20:22 CrossPython 阅读(178) 评论(0) 推荐(0)
摘要:let df = ctx.sql("SELECT distinct \"扫描人\" FROM example").await?;or let df = ctx.sql("SELECT distinct ‘扫描人’ FROM example").await?; => failed. 阅读全文
posted @ 2022-08-21 19:08 CrossPython 阅读(103) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2022-08-16 21:15 CrossPython 阅读(26) 评论(0) 推荐(0)
摘要:(val1 - val2).abs() < f64::EPSILON val1.to_ne_bytes() == val2.to_ne_bytes() 或者 val1.to_bits() == val2.to_bits() 阅读全文
posted @ 2022-08-15 12:40 CrossPython 阅读(133) 评论(0) 推荐(0)
摘要:use std::sync::{Arc, Mutex, Condvar}; use std::thread; use std::cell::RefCell; #[derive(Debug)] struct D{ name: RefCell<String>, data: Vec<i32> } #[de 阅读全文
posted @ 2022-08-10 14:46 CrossPython 阅读(35) 评论(0) 推荐(0)
摘要:Rc<T>/RefCell<T>用于单线程内部可变性, Arc<T>/Mutex<T>用于多线程内部可变性。 阅读全文
posted @ 2022-08-09 10:41 CrossPython 阅读(121) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2022-08-09 09:55 CrossPython 阅读(22) 评论(0) 推荐(0)
摘要:一个简单的需求:读入一个目录内的所有文本文件,每个文件的格式都是每一行定义一个二维点,例如x=1,y=2;获取所有点的一个列表。这里不使用serde或者现成的parser库,这么简单的格式直接手写就行了 没有错误处理 先来一个糙快猛的版本。其中用了一个nightly feature str_spli 阅读全文
posted @ 2022-08-06 20:43 CrossPython 阅读(76) 评论(0) 推荐(0)
摘要: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:: 阅读全文
posted @ 2022-08-04 20:34 CrossPython 阅读(31) 评论(0) 推荐(0)
摘要:rust web, salvo, 阅读全文
posted @ 2022-08-03 15:35 CrossPython 阅读(33) 评论(0) 推荐(0)