serde icon indicating copy to clipboard operation
serde copied to clipboard

Specifying `bound`, `from`, `into`, `try_into` without using quotes

Open KSXGitHub opened this issue 10 months ago • 0 comments

Quotes are ugly and they don't play well with rust-analyzer refactoring.

I propose this syntax:

#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(
    bound(
        serialize(Value: Into<String> + Clone),
        deserialize(String: Into<Value>),
    ),
    from(String),
    into(String),
)]
pub struct MyStruct<Value> {
    pub value: Value,
}

This issue was inspired by derive_more v1.0.0-beta.3 where I don't need quotes in trait bound.

KSXGitHub avatar Oct 16 '23 16:10 KSXGitHub