惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
美团技术团队
腾讯CDC
博客园 - Franky
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
aimingoo的专栏
aimingoo的专栏
博客园_首页
V
V2EX
Martin Fowler
Martin Fowler
T
The Blog of Author Tim Ferriss

The Rust Programming Language Forum - Latest posts

What's everyone working on this week (21/2026)? Rust Function Call with one Param Iced + Canvas + Text: How do I create a style for canvas text "Value dropped while borrowed" as a lifetime mismatch Weird `use of moved value` behaviour Slightly surprising behavior of a while loop Clap: how to disable options after a certain positional argument How do i tell rust-analyzer what kind of bracket to use for a macro? Iterator + Borrow Checker: Work around borrowing already borrowed mutable variable Requesting data via mavlink SKILLS.md for Rust development 🧵 Stringlet UTF-8 Hack Option Niche? Iterator + Map - How do divide every element, including the last element, by the last element Why can't we store returned value of a function in a variable if one of the parameters goes out of scope My first crate :D, floop: A more convenient and less error prone replacement for loop `{ select! { .. }}` Sorting is slow because architectures are wrong — zan-sort redesigns the architecture, not the algorithm Iced Font - Create a custom monospace font to display dollar amounts Is the UnsafePinned RFC wrong about being able to return `&mut T` from `get_mut_unchecked`? Fixing Polars 0.37 compilation errors: Hashbrown 0.17 dependency conflict and decimal parsing Any plans for improving error diagnostic in Rust 2.0? How do I build completely offline? Is `&mut T -> &mut ManuallyDrop<T>` well-defined and sound? Would you use this? — fixtura, declarative fake data injection for tests Foreign trait restrictions on native types make generics hard to use Cargo Exclude Directive Compiler reasoning around a modulo counter Multiple mutable references to elements within one vector Handling non-`Send` data in a `Send` closure Review: Static Multi Pool Allocator Rmquickjs - High-level MicroQuickJS bindings for Rust
Iced + Rusqlite + Chrono: Problem with custom error type
@eechris · 2026-04-25 · via The Rust Programming Language Forum - Latest posts
I am trying to learn to better harness rusts functionality. In an attempt to do so I am using a custom error which will allow the use of ? to handle both chrono and rusqlite errors in the returned result from a function. The code compiles/runs and the correct string values are returned. But I get several warnings which I do not understand how to resolve. Below is the function and the warning messages. Any assistance will be appreciated. #[derive(Debug)] pub enum SqlChronoError { SqlError(rusqlite::Error), ChronoError(chrono::ParseError), } impl From<rusqlite::Error> for SqlChronoError { fn from(error: rusqlite::Error) -> Self { SqlChronoError::SqlError(error) } } impl From<chrono::ParseError> for SqlChronoError { fn from(error: chrono::ParseError) -> Self { SqlChronoError::ChronoError(error) } } pub async fn get_start_dates() -> Result<Vec<String>, SqlChronoError> { let db_file_path: &str = "stock_data.db"; let conn = Connection::open(db_file_path)?; let lastest_datetime_string = conn.query_row("SELECT MAX(date) FROM data", [], |row| row.get(0).map(|x: String| x.to_string()))?; let latest_datetime = NaiveDate::parse_from_str(&lastest_datetime_string, "%Y-%m-%d")?; const OFFSET_DAYS: [Days; 4] = [Days::new(90), Days::new(180), Days::new(365), Days::new(3650)]; let start_dates = OFFSET_DAYS.iter() .filter_map(|offset| latest_datetime.checked_sub_days(*offset)) .map(|nav_date| nav_date.format("%Y-%m-%d").to_string()) .collect::<Vec<String>>(); Ok(start_dates) } warning: field `0` is never read --> src/functions/start_dates.rs:6:14 | 6 | SqlError(rusqlite::Error), | -------- ^^^^^^^^^^^^^^^ | | | field in this variant | = note: `SqlChronoError` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 6 - SqlError(rusqlite::Error), 6 + SqlError(()), | warning: field `0` is never read --> src/functions/start_dates.rs:7:17 | 7 | ChronoError(chrono::ParseError), | ----------- ^^^^^^^^^^^^^^^^^^ | | | field in this variant | = note: `SqlChronoError` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 7 - ChronoError(chrono::ParseError), 7 + ChronoError(()), | warning: `csvtosql` (bin "csvtosql") generated 2 warnings