Skip to content

Serde support #1

Description

@dtolnay

@AltSysrq do you have any sense of what functionality would be required from Serde before fourleaf could take advantage of Serde's serialize and deserialize traits?

The only one I could discern from the docs is zero-copy deserialization of &str and &[u8] which has already been merged in Serde and will be available in the next release:

#[derive(Serialize, Deserialize)]
struct S<'a, 'b, 'c, 'd, 'e> {
    // copied from the input
    w: String,

    // &str and &[u8] are always implicitly borrowed from the input
    x: &'a str,

    // other types require an attribute to opt into borrowing
    #[serde(borrow)]
    y: Cow<'b, str>,

    // can narrow down which lifetimes should be borrowed
    #[serde(borrow = "'c + 'd")]
    z: Z<'c, 'd, 'static, 'e>,
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions