Giter VIP home page Giter VIP logo

Comments (4)

tarcieri avatar tarcieri commented on June 1, 2024

I'm planning on adding this, but via a custom derive rather than a wrapper type. This avoids the need to thunk through things like Deref/Borrow solely for the purpose of adding a Drop impl.

I think it'd wind up looking like this:

trait ZeroizeOnDrop: Zeroize + Drop {}
#[derive(ZeroizeOnDrop)]
pub struct MyStruct { ... }

from crates.

ebfull avatar ebfull commented on June 1, 2024

If you're trying to use someone else's struct from another library you won't be able to leverage a custom derive, so it still seems useful to have a ZeroizeOnDrop utility struct, though it comes at the cost of making the API larger for this library.

from crates.

tarcieri avatar tarcieri commented on June 1, 2024

I think a struct ZeroizeAThingOnDrop<T: Zeroize>(T) would also be useful to have, however:

  • I'd definitely like to support the custom derive, so we'd need names which clearly disambiguate trait ZeroizeOnDrop and struct ZeroizeAThingOnDrop (the latter is not intended as a serious suggestion)
  • This functionality is already provided by the clear_on_drop crate. Would it make more sense to submit a PR to that crate to use zeroize, so all existing users get the benefits of zeroize for free?

from crates.

tony-iqlusion avatar tony-iqlusion commented on June 1, 2024

Added Zeroizing<Z> in #182

from crates.

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.