摘要:
// // // // 字符串 // 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:: 阅读全文
摘要:
document.getElementsByTagName("video")[0].playbackRate = 1.75 数字1.75代表1.75倍速 playbackRate 阅读全文
摘要:
首先单击“开始运行”,在输入框中键入“regedit”打开注册表编辑器,然后在注册表编辑器左方控制台中依次单击展开 “HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/Current Version/Winlogon”,再选择“编辑添加字符串值”,在数 阅读全文
摘要:
源代码里要改这个位置, 增加async _channel.setMethodCallHandler((MethodCall call) { _channel.setMethodCallHandler((MethodCall call) async { 阅读全文
摘要:
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 阅读全文
摘要:
pandas索引尽量避免写成dfd.loc[0]['a'],会导致赋值失败-- 尽量写成dfd.loc[0, 'a']格式 遇到需要loc与iloc结合的混合索引办法 阅读全文
摘要:
import pywifi import time from pywifi import const # WiFi扫描模块 def wifi_scan(): # 初始化wifi wifi = pywifi.PyWiFi() # 使用第一个无线网卡 interface = wifi.interface 阅读全文
摘要:
布署 这是我的目录结构: . ├── Cargo.lock ├── Cargo.toml ├── code.md ├── diesel.toml ├── .env ├── migrations ├── README.md ├── src ├── static └── target 使用cargo r 阅读全文
摘要:
https://www.easysap.com/index.php?q-6884.html 阅读全文
摘要:
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 阅读全文
摘要:
https://zhuanlan.zhihu.com/p/492292655 阅读全文
摘要:
#[derive(Debug)] enum Unit{ INT(i32), STR(String), FLOAT(f32) } #[derive(Debug)] struct People{ name: String, elements: Vec<Unit> } impl IntoIterator 阅读全文
摘要:
struct CountdownIterator(i32); impl Iterator for CountdownIterator { type Item = i32; fn next(&mut self) -> Option<Self::Item> { self.0 -= 1; if self. 阅读全文
摘要:
use std::ptr; use std::fmt::{ Display, Formatter, Result }; pub struct Node { value: i32, next: *mut Node } impl Node { pub fn new(val: i32) -> Self { 阅读全文
摘要:
通过迭代器提供的filter()和collect()方法。 let list2: Vec<_> = (1..=100).filter(|i| i%3 == 0).collect();assert_eq!(list1, list2); take(k)取前面k个元素。 迭代器调用take()后,迭代器的 阅读全文
摘要:
use postgres::{Client, NoTls}; fn main(){ let mut client = Client::connect("host=localhost user=postgres password=postgres port=5433", NoTls).unwrap() 阅读全文
摘要:
use std::fmt::{Debug, Display}; use std::any::TypeId; use std::any::Any; fn is_string<T: ?Sized + Any>(_s: &T) -> bool { TypeId::of::<String>() == Typ 阅读全文
摘要:
mopa = 0.2 use mopa; use std::fmt::Debug; use std::fmt::Display; use std::any::TypeId; fn is_string<T: ?Sized + mopa::Any>(_s: &T) -> bool { TypeId::o 阅读全文
摘要:
#[macro_use] extern crate mopa; struct Bear { // This might be a pretty fat bear. fatness: u16, } impl Bear { fn eat(&mut self, person: Box<dyn Person 阅读全文
摘要:
downcast-rs = "1.2" // Can call macro via namespace since rust 1.30. use downcast_rs::Downcast; use std::fmt::Debug; // To create a trait with downcas 阅读全文
摘要:
use std::any::Any; use core::fmt::Debug; trait ColTrait: std::fmt::Debug{ fn getself<T>(&self)->T; } #[derive(Debug)] struct DataCell<T>{ val:T, } // 阅读全文
摘要:
use std::{any::{Any, TypeId}, fmt::Debug}; use downcast_rs::Downcast; fn is_string<T: ?Sized + Any>(_s: &T) -> bool { TypeId::of::<String>() == TypeId 阅读全文
摘要:
use std::collections::HashMap; use std::ops::Index; #[derive(Debug,Clone)] struct Cell{ name:String } type Col = HashMap<String, Vec<Cell>>; #[derive( 阅读全文