Annoying... There is a bug open for serde since 2017 conserning f64::NAN/ JSON null value.

No justification about why no one seem to want to fix it.

I don't know why you wouldn't try to fix this in 9 fucking years!

At least make it so that serializing then deserializing a f64::NAN don't throw out the entire structures?

Or alternativelly, (still annoying to me but coherent) throw an error when serializing NAN value? Just so that you don't end up with some unusable json file?

My preference would be to be able to handle nan, and infs value gracefully without needing me to write my own damned serializer/deserializer.

#rust #serde

Unfair #rustlang #serde Quiz: What's the difference between these four types' deserialization behavior (ignoring the type name)?

#[derive(Deserialize)]
struct One {
field: Option<String>,
}

#[derive(Deserialize)]
struct Two {
#[serde(default)]
field: Option<String>,
}

#[derive(Deserialize)]
struct Three {
#[serde(deserialize_with = "Option::deserialize")]
field: Option<String>,
}

#[derive(Deserialize)]
struct Four {
#[serde(default, deserialize_with = "Option::deserialize")]
field: Option<String>,
}

@simontatham greatness averted, we could have had #derive #async_trait #strum #tokio #command #cfg #serde

Today, I once again wake up worrying about #Rust 's future.

Why is a shitbag such as #dtolnay still allowed to single-handedly maintain fundamental libraries for the ecosystem? Why is he part of Library API team? How is he not permabanned for single-handedly permanently damaging Rust by killing off comptime reflection over his racism? How is he not permabanned for the power play he attempted to pull with his "RFC" after pushing pre-compiled binary to serde without notice? Why are MIC companies routinely tolerated at Rust conventions? Why does no one talk about it, despite the problems not being solved? Has #Ruby takeover taught people nothing? Will Rust survive another year without turning into #fashtech?

So many questions. I think about them every time I use Rust, which is often.

Apropos of nothing.

#RustLang #serde #FOSS #OSS #OpenSource

🌘 cGp-serde 登場:一個由 CGP 驅動、專為 Serde 設計的模組化序列化函式庫
➤ 突破 Rust trait 限制,實現更彈性的序列化與反序列化
https://contextgeneric.dev/blog/cgp-serde-release/
這篇文章介紹了 cgp-serde,一個創新的 Rust 序列化函式庫,它透過整合 Context-Generic Programming (CGP) 的能力,解決了 Rust 標準語trait 限制。CGP 讓開發者能夠繞過 Rust 的一致性規則,撰寫重疊或孤兒的 trait 實作,特別是在處理 Serde 的 Serialize 和 Deserialize trait 時。這使得基於運行時上下文(例如使用arena分配器)的客製化反序列化成為可能。文章詳細說明瞭 CGP 的核心概念,如何轉換現有 trait,以及 cgp-serde 如何實作模組化序列化與反序列化,並提供具體範例。
+ CGP 聽起來很強大,解決了 Rust 在某些場景下 trait 實
#程式設計 #Rust #序列化 #Serde #CGP
Announcing cgp-serde: A modular serialization library for Serde powered by CGP | Context-Generic Programming

Just released a new crate, it lets you serialize output of methods using `serde`.

https://github.com/j-g00da/serde-more

#serde #rust #rustlang

GitHub - j-g00da/serde-more: Procedural macro to add arbitrary data when serializing using serde

Procedural macro to add arbitrary data when serializing using serde - j-g00da/serde-more

GitHub
@asonix But that sounds right like what @KingmaYpe suggested:
enum FieldString { Quoted(String), Bare(String) }
The hard part is probably to send those through serde's interface, right? You could probably recognize the names in your serializer in serialize_newtype_variant and then emit possibly-quotes and the inner value.
Whether that is good use of #Serde, I do not know.

RE: https://masto.asonix.dog/@asonix/115487539746688367

quooting to improve hashtag visibility

serde-knower-abouters please help

#rustlang #serde #rust

Can anyone point me to a serde data format that uses multiple distinct string representations?

Or a serde data format that isn't self-describing?

Or a serde data format that has distinct "top level" types that are different from inner types

Unfortunately I'm implementing a data format that has all of these things and it's making serde hard

#rustlang #rust #serde

what if we kissed at the Serde documentation site? implementing Serialize and Deserialize f... - 10/14/2025, 11:26:31 PM

https://video.asonix.dog/w/ayvPxvP63baW1UoUjWuF4J

what if we kissed at the Serde documentation site? implementing Serialize and Deserialize f... - 10/14/2025, 11:26:31 PM

PeerTube