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

推荐订阅源

L
LangChain Blog
J
Java Code Geeks
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
人人都是产品经理
人人都是产品经理
博客园 - 【当耐特】
雷峰网
雷峰网
D
DataBreaches.Net
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 聂微东
V
Visual Studio Blog
Apple Machine Learning Research
Apple Machine Learning Research
N
Netflix TechBlog - Medium
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
Blog — PlanetScale
Blog — PlanetScale
Engineering at Meta
Engineering at Meta

The Rust Programming Language Forum - Latest topics

C++ to Rust -- Exceptions Re-exporting a trait with a custom derive_macro Gold linker is deprecated Why is using PhantomData valid in this case? Code review for Static Pool Allocator Looking for a pool based allocator Why is this legal? What does it mean for Rustc to run "out of TLS keys"? Using async/await internally with no internal runtime, but exposing a nonblocking poll API — is this a reasonable design? Testing functions that use randomness `cargo-path`: improve coding agents&#39; ability to find Rust documentation Rust task runners Lifetime weird case Windows - USB device not detected A random rustc-ice-[...].txt file appeared Develop rust where the environment is setup in a docker Undefined Behavior: in-bounds pointer arithmetic failed: attempting to offset pointer by 20 bytes, but got alloc238 which is only 1 byte from the end of the allocation Unbug 0.5 - Runtime debug assertions Is there a tiny error in section 6.2 Reference types? Lifetime woes implementing ratatui::Widget for a reference Rusqlite + Chrono: How do I simplify code to obtain chrono datetime value From OOP to Rust – struggling with code organization and data structure design Way to avoid a self-referential struct Rust RF and audio resources/communities Whyhttp - HTTP mocks that fail where the bug actually is Using tokio channel permits in a tower service Arc::increment_strong_count design question (cross-post) `&T`, `&mut T`, `Pin<&mut T>` and `&Cell<T>`: Ways of Borrowing a `T` Ratatui detect arrow key press and release Feedback about post in medium
Iced + Rusqlite + Chrono: Problem with custom error type
@eechris · 2026-04-25 · via The Rust Programming Language Forum - Latest topics
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