VSTest is Removing its Newtonsoft.Json Dependency - .NET Blog

VSTest is removing its Newtonsoft.Json dependency in .NET 11 and Visual Studio 18.8. Here's who is affected and how to fix it.

.NET Blog
🌗 透過 Box 最佳化 Rust 記憶體使用
➤ 深入 Rust 記憶體模型:如何利用 Box 與自訂反序列化節省巨量記憶體
https://dystroy.org/blog/box-to-save-memory/
這篇文章深入探討如何在一個真實的 Rust 程式中,透過最佳化資料結構配置與 JSON 反序列化方式,大幅減少記憶體使用。作者的程式需將數千個 AWS Smithy 模型 JSON 檔案反序列化成 Rust 結構,但初始實現佔用了 895MB 記憶體。作者分析指出,許多結構中的選用字串欄位實際上是空的。問題根源在於 Rust 中 `Option<String>` 受惠於編譯器利基最佳化,但 `Option<Struct>` 卻不見得,導致即使內部結構為空,仍佔用大量記憶體。為解決此問題,作者將這些可能為空的內部結構改為 `Option<Box<Struct>>` 型態,並實作自訂的反序列化邏輯:當結構的選用欄位皆為空時,則反序列化為 `None`;否則,則將結構裝箱(Box)後存入堆(heap)
#Rust #記憶體優化 #Serde #JSON 反序列化 #效能
Box to save memory

dystroy - blog

Nice surprise, @MediaArea have uploaded a bunch of #NTTW9 videos including mine on JSONID:

https://www.youtube.com/watch?v=ZMVb3Bc_irc

Check out their YouTube, and also I'd love to hear feedback on JSONID too. Please follow it on GitHub: https://github.com/ffdev-info/jsonid/

#digipres #serde #FileFormats #JSON #YAML #TOML

No Time To Wait - S09E12 - Day 1 - Introducing JSONID - Ross Spencer

YouTube

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.