Allow easy concatenation of bip32 derivation paths#459
Allow easy concatenation of bip32 derivation paths#459apoelstra merged 1 commit intorust-bitcoin:masterfrom
Conversation
6965a26 to
195fad1
Compare
|
src/util/bip32.rs
Outdated
There was a problem hiding this comment.
-
you override the
pathinput variable here -
why does this create a new DerivationPath instead of extending the current? (I see that
child()does the same) -
why is
impl AsRef<[ChildNumber]>better than a simple&[ChildNumber]?
There was a problem hiding this comment.
Number 3 makes this non-compiling for the current MSRV btw
Currently one has to convert the path into a Vec<ChildNumber>, extend it and finally convert it back again.
195fad1 to
202a946
Compare
|
Sorry, fixed.
|
There was a problem hiding this comment.
I think more idiomatic way of doing this may be
pub fn extend<T: IntoIterator<Item=ChildNumber>>(&self, path: T) -> DerivationPath {
self.into_iter(0).chain(path).collect()
}This will require impl IntoIter for DerivationPath, but this is trivial and will be useful anyway
Also, if you will choose that route, I propose to impl ExactSizeIterator for DerivationPath as well
|
PS: the current travis failure seems related to #468 |
Could you give a concrete example of what it will allow that |
|
concept ACK. I'm a little ambivalent about using |
|
Also tested ACK |
Currently one has to convert the path into a
Vec<ChildNumber>, extend it and finally convert it back again.