-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add Borsh #150
feat: add Borsh #150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs to be behind a borsh
feature, as I mentioned in tari_utilities
+1 on this Will have to use a pattern similar to: use std::fmt::{Debug, Display};
pub struct Foo<T> {
bar: T
}
impl<T> Foo<T>
where
T: Debug,
{
pub fn baz(&self) {
print!("{:?}", self.bar)
}
}
#[cfg(feat)]
impl<T> Foo<T>
where
T: Debug,
T: Display,
{
pub fn baz2(&self) {
print!("{}", self.bar)
}
} |
e1cce8d
to
8295bd1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
463b641
to
bac0b6c
Compare
src/keys.rs
Outdated
@@ -40,6 +42,49 @@ pub trait SecretKey: ByteArray + Clone + PartialEq + Eq + Add<Output = Self> + D | |||
/// implementations need to implement this trait for them to be used in Tari. | |||
/// | |||
/// See [SecretKey](trait.SecretKey.html) for an example. | |||
/// cbindgen:ignore | |||
#[cfg(feature = "borsh")] | |||
pub trait PublicKey: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having a different trait depending on whether the borsh feature flag is enabled or not could be troublesome.
Any reason we require these trait bounds in the trait itself? They can always be specified where needed.
Suggest these changes: |
Add Borsh(De)Serialize for keys and signatures.