GithubHelp home page GithubHelp logo

Comments (11)

apoelstra avatar apoelstra commented on June 21, 2024 1

PhantomData has only one value, called PhantomData. Use that.

from rust-bitcoin.

Kixunil avatar Kixunil commented on June 21, 2024

FYI I had a PR to do this but it got stale and I'm actually currently working on a replacement since the hash stuff got complicated.

from rust-bitcoin.

apoelstra avatar apoelstra commented on June 21, 2024

from_byte_array and all_zeros could be made const and we could do a point release (assuming there are no other breaking changes in the hashes pipeline yet, which I believe is true).

Actually hashing in constant time is far from trivial, though I haven't tried in a little while.

from rust-bitcoin.

Kixunil avatar Kixunil commented on June 21, 2024

Actually hashing in constant time is far from trivial, though I haven't tried in a little while.

We already have that :)

from rust-bitcoin.

apoelstra avatar apoelstra commented on June 21, 2024

Oh, lol :). So @stevenroose there is a const constructor.

But agreed that all_zeros and from_byte_array should also be const.

from rust-bitcoin.

Kixunil avatar Kixunil commented on June 21, 2024

Definitely!

from rust-bitcoin.

tcharding avatar tcharding commented on June 21, 2024

Seems that Rust does not allow functions within traits to be marked as const.

ref: https://users.rust-lang.org/t/whats-the-reason-that-fn-in-a-trait-cannot-marked-as-a-const/68636

from rust-bitcoin.

apoelstra avatar apoelstra commented on June 21, 2024

Ah, yeah, that is probably why these aren't const already. We should move those methods out of the trait into inherents.

from rust-bitcoin.

Kixunil avatar Kixunil commented on June 21, 2024

We should move those methods out of the trait into inherents.

Yes!

from rust-bitcoin.

15IITian avatar 15IITian commented on June 21, 2024

image

pub struct Hash<T: Tag>([u8; 32], PhantomData<T>);

In all_zeros and from_byte_array methods in Hash<T> impl -> what should be the value of PhantomData part in it?

from rust-bitcoin.

15IITian avatar 15IITian commented on June 21, 2024

Did anyone also getting same errors while making commits ?

image

image

from rust-bitcoin.

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.