Error trying to deserialize TOML using Rust/SERDE

This page summarizes the projects mentioned and recommended in the original post on /r/u_Square-Bet-2140

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • toml-rs

    Discontinued A TOML encoding/decoding library for Rust

  • use std::fs::File; use std::io::Write; use std::collections::BTreeMap as Map; use serde_derive::{Serialize, Deserialize}; #[derive(Debug)] #[derive(Serialize, Deserialize)] #[serde(tag = "type0")] enum FooBarTwo<'a> { FooBarOne { string1: &'a str }, } #[derive(Debug)] #[derive(Serialize, Deserialize)] #[serde(tag = "type1")] enum FooBarThree<'a> { FooBarFour { string2: &'a str }, } #[derive(Debug)] #[derive(Serialize, Deserialize)] struct FooBarFour<'a> { black: &'a str, #[serde(borrow)] green: FooBarTwo<'a>, #[serde(borrow)] blue: FooBarThree<'a>, } #[derive(Debug)] #[derive(Serialize, Deserialize)] struct FooBarFourList<'a> { // Uasing a Map to workaround a known bug (#303) when using top level Vec // see https://github.com/alexcrichton/toml-rs/issues/303 #[serde(borrow)] foo_bar_six: Map<&'a str, FooBarFour<'a>> } fn main() { let red = FooBarFour { black: "aaa", green: FooBarTwo::FooBarOne { string1: "aaaabbbb" }, blue: FooBarThree::FooBarFour { string2: "ccccccc" }, }; let pink = FooBarFour { black: "aaa", green: FooBarTwo::FooBarOne { string1: "aaaabbbb" }, blue: FooBarThree::FooBarFour { string2: "ccccccc" }, }; let mut white = Map::new(); white.insert("pink", pink); white.insert("red", red); let fbfl = FooBarFourList { foo_bar_six: white }; println!("\nTL: {:?}\n", fbfl); let filename = "./data/test.toml"; let data = toml::to_string(&fbfl).expect("Error serialising fbfl"); println!("\nTL as TOML: {:?}\n", data); let mut f = File::create(filename).expect("Unable to create file"); f.write_all(data.as_bytes()).expect("Error writing data to file"); let toml_in: FooBarFour = toml::from_str(&data).expect("Error deserialising fbfl"); println!("\n{:?}\n", toml_in); }

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Komorebi – A tiling window manager for Windows written in Rust

    1 project | news.ycombinator.com | 3 May 2024
  • Blue-Recorder, a Simple Screen Recorder Written in Rust

    1 project | news.ycombinator.com | 3 May 2024
  • Sponsoring the Rust-based Rocket Web framework

    1 project | dev.to | 3 May 2024
  • Ask HN: I have been unable to land a job in two years, does anybody

    1 project | news.ycombinator.com | 3 May 2024
  • GitHub – Blockstream/Lwk at Blog.blockstream.com

    1 project | news.ycombinator.com | 3 May 2024