GithubHelp home page GithubHelp logo

Comments (7)

ionut-arm avatar ionut-arm commented on May 27, 2024

@hug-dev would this impact the SE driver in a major way?

from parsec-client-rust.

hug-dev avatar hug-dev commented on May 27, 2024

this could/should be changed so that most parameters are instead passed by reference.

what do you think would be the advantages of this? Do you have any examples in mind?

@hug-dev would this impact the SE driver in a major way?

I don't think so! It can adapt 😃

from parsec-client-rust.

ionut-arm avatar ionut-arm commented on May 27, 2024

what do you think would be the advantages of this? Do you have any examples in mind?

Yeah, the key name is a big example - we take it as an owned string everywhere... it would be much nicer and idiomatic for a user to just do &key_name instead of key_name.clone() every time. But pretty much all other attributes (e.g. AsymmetricEncryption for sign and verify) do the same

from parsec-client-rust.

hug-dev avatar hug-dev commented on May 27, 2024

Yeah, the key name is a big example - we take it as an owned string everywhere... it would be much nicer and idiomatic for a user to just do &key_name instead of key_name.clone() every time.

Definitely agree for the name! For the other non-Copy type, I guess we will have to review them on a case-by-case basis. Basically it only depends if the client needs to re-use the values after calling the function.

from parsec-client-rust.

hug-dev avatar hug-dev commented on May 27, 2024

I guess the default should be to take references everywhere unless the types are Copy.
For String it should be &str and for Vec<u8> &[u8]

from parsec-client-rust.

ionut-arm avatar ionut-arm commented on May 27, 2024

I think we've debated this before - passing by reference ends up "hiding" the fact that you actually want an instance of that data and that you're going to clone it. I don't know if it's sensible to just assume that if a type implements Clone we can treat a reference the same way as an owned instance.

from parsec-client-rust.

hug-dev avatar hug-dev commented on May 27, 2024

I think most BasicClient methods take references to buffers now. The thing that would be nice is to use &str instead of String for keys as the latter implies making .clone everywhere... Ideally the clone should be done at the end to hide the complexity before.

Renaming this issue to that. Actually closing and opening a new one.

from parsec-client-rust.

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.