Coder Social home page Coder Social logo

Comments (5)

tikue avatar tikue commented on August 16, 2024

Thanks for the suggestion! I agree this could be supported.

It'd be nice to replace the derive_serde arg with something generic enough to support this new use case. Maybe something like this would be possible:

#[tarpc::service(derive = [tarpc::serde::Serialize, tarpc::serde::Deserialize, Clone, Hash])]
service World {
    async fn hello(message: String) -> String;
}

from tarpc.

ShaneMurphy2 avatar ShaneMurphy2 commented on August 16, 2024

@tikue Got a first cut up on a branch: https://github.com/ShaneMurphy2/tarpc/tree/customizable-derives, let me know what you think so far.

Still need to see what breaks by changing the macro syntax, but the core use case works.

from tarpc.

tikue avatar tikue commented on August 16, 2024

Looks nice! It'd be nice for derive_serde and derive to be mutually exclusive, so that people are encouraged to make the switch. In particular:

  • derive_serde and derive at the same time should be an error
  • derive should only derive Serialize/Deserialize when they are explicitly listed
  • derive_serde is deprecated - output a warning when it is used, and suggest instead using either derive = [] to disable, or derive = [Serialize, Deserialize] to explicitly enable
  • for backwards compatibility, absence of derive can derive Serialize/Deserialize by default.

from tarpc.

ShaneMurphy2 avatar ShaneMurphy2 commented on August 16, 2024

Looks nice! It'd be nice for derive_serde and derive to be mutually exclusive, so that people are encouraged to make the switch. In particular:

  • derive_serde and derive at the same time should be an error
  • derive should only derive Serialize/Deserialize when they are explicitly listed
  • derive_serde is deprecated - output a warning when it is used, and suggest instead using either derive = [] to disable, or derive = [Serialize, Deserialize] to explicitly enable
  • for backwards compatibility, absence of derive can derive Serialize/Deserialize by default.

On it πŸ‘

from tarpc.

ShaneMurphy2 avatar ShaneMurphy2 commented on August 16, 2024

@tikue PR is up!

from tarpc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.