Skip to content

Add serde::Serialize/serde::Deserialize to fluent_builders #645

Open
@thomas-k-cameron

Description

@thomas-k-cameron

Describe the feature

It allows you to define/save models with file format supported by serde.

Once this feature is implemented you can,

  • save your input to disk in your favourite file format
  • load your input from disk using serde

Use Case

It allows you to define/save models with file format supported by serde.

Once this feature is implemented you can,

  • save your input to disk in your favourite file format
  • load your input from disk using serde

Proposed Solution

add new function fn with_builder() to any structs that implements async fn send().

pub struct CopyObject {
    handle: std::sync::Arc<super::Handle>,
    inner: crate::input::copy_object_input::Builder,
}
impl CopyObject {
    pub(crate) fn with_builder(handle: std::sync::Arc<super::Handle>, inner: crate::input::copy_object_input::Builder) -> Self {
        Self {
            handle,
            inner
        }
    }
}

mod copy_object_input {
    #[derive(std::clone::Clone, std::fmt::Debug, serde::Serialize, serde::Deserialize)]
    struct Builder {
        ...
    }
}

let s3_client = aws_sdk_s3::Client::from(config).copy_object();
let copy_object: CopyObject = s3_client
    .copy_object()
    .with_builder(serde_json::from_str(std::fs::read_to_string("copy_object.json").unwrap()).unwrap())

copy_object.send().await;

Other Information

Potential concerns

  1. Binary size may become bigger
  2. Compilation time may increase
  3. You might want to add #[cfg(feature = "serde")] or something to address the concerns that mentioned above.

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

A note for the community

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.p2This is a standard priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions