随笔分类 - 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
阅读全文
摘要:下载地址: https://www.postgresql.org/ftp/odbc/versions/msi/ 连接字符串,一般的结构是: Driver={PostgreSQL ODBC Driver(UNICODE)};server=127.0.0.1;port=5432;database=数据库
阅读全文
摘要:extern crate r2d2; use std::{thread, io::Read}; use r2d2_postgres::{postgres::{NoTls, GenericClient, SimpleQueryRow, SimpleQueryMessage}, PostgresConn
阅读全文
摘要:#[tokio::main] async fn main()->Result<()> { let m = read_excel("abc.xlsx", 1, "Sheet1").unwrap(); let ctx = SessionContext::new(); ctx.register_table
阅读全文
摘要:// // // // 字符串 // let mut sbuilder = StringBuilder::new(100); // sbuilder.append_value("a").unwrap(); // sbuilder.append_null().unwrap(); // sbuilder
阅读全文
摘要:// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this
阅读全文
Rust 里 String,str,Vec<u8>,Vec<char> 相互转换【Conversion between String, str, Vec<u8>, Vec<char> in Rust】
摘要:use std::str; fn main() { // 起始:Vec let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}']; // 从 Vec 转换为String let string1: String = src1.ite
阅读全文
摘要:extern crate tokio; pub mod datatable; pub mod handle_error; pub mod common; use chrono::prelude::*; use chrono::offset::LocalResult; use datafusion::
阅读全文
摘要:use std::sync::Arc; use datafusion::arrow::datatypes::{ DataType, Field, Schema}; use datafusion::arrow::record_batch::RecordBatch; use datafusion::ar
阅读全文
摘要:extern crate arrow; extern crate tokio; use std::convert::TryFrom; use std::sync::Arc; // use arrow::array::{Float64Array, Int64Array, Date32Array, Da
阅读全文
摘要:布署 这是我的目录结构: . ├── Cargo.lock ├── Cargo.toml ├── code.md ├── diesel.toml ├── .env ├── migrations ├── README.md ├── src ├── static └── target 使用cargo r
阅读全文
摘要: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::
阅读全文