You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use num_complex::{Complex64}use serde::{Deserialize,Serialize};#[derive(Serialize,Deserialize)]#[serde(remote = "Complex64")]pubstructComplex64Def{pubre:f64,pubim:f64,}implFrom<Complex64Def>forComplex64{fnfrom(def:Complex64Def) -> Complex64{Complex64::new(def.re, def.im)}}fnmain(){letmut one = Complex64{re:1.0,im:2.0};letmut json_buffer = serde_json::to_string(&one).unwrap();println!("{}", json_buffer);}
I'm trying to convert some types to json. This is the simplified version of what doesn't work. The above throws out the error the trait `Serialize` is not implemented for Complex<f64>. Related to #2327.
Use num_complex::Complex with or without generic typing T doesn't work either (num_complex::Complex<f64> = num_complex::Complex64).
The text was updated successfully, but these errors were encountered:
Hi @attacker0211, sorry that no one was able to provide guidance here. If this is still an issue, you could try taking this question to any of the resources shown in https://www.rust-lang.org/community. This library is one of the most widely used Rust libraries and plenty of people will be able to provide guidance about it.
I'm trying to convert some types to json. This is the simplified version of what doesn't work. The above throws out the error
the trait `Serialize` is not implemented for Complex<f64>
. Related to #2327.Use
num_complex::Complex
with or without generic typingT
doesn't work either (num_complex::Complex<f64> = num_complex::Complex64
).The text was updated successfully, but these errors were encountered: