thedodd / wither

An ODM for MongoDB built on the official MongoDB Rust driver.
https://docs.rs/wither
Other
327 stars 40 forks source link

Model: failed to parse serde rename attr #50

Closed losintikfos closed 4 years ago

losintikfos commented 4 years ago

I am trying to experiment with branch 42-new-driver with the model below.

use bson::oid::ObjectId;
use serde::{Deserialize, Serialize};
use wither::Model;

#[derive(Serialize, Deserialize, Model)]
struct Foo {
    #[serde(rename = "_id", skip_serializing_if = "Option::is_some")]
    id: Option<ObjectId>,
}

The serde(rename... annotation generated this error:

failed to parse serde rename attr

help: Unexpected literal type stringrustc ...

The error disappear when I remove Model from derive -- do you know why this is happening?

thedodd commented 4 years ago

Oh man. Yea, there is a lot of stuff that is unstable on that branch right now ... I have another large changeset coming in on that branch very soon (I've been hacking on it over the last few days).

thedodd commented 4 years ago

It is definitely not ready for use right now.