-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The open operation in the bs crate has a function called open_plog
that takes two callback functions. I think the more idiomatic way to implement this is to pass in a reference to a trait impl. The current code looks like this:
pub fn open_plog<F1, F2>(config: Config, get_key: F1, sign_entry: F2) -> Result<Log, Error>
where
F1: Fn(&Key, Codec, usize, usize) -> Result<Multikey, Error>,
F2: Fn(&Multikey, &[u8]) -> Result<Multisig, Error>,
{
// ...
}
I think the more idiomatic way is to define a traits and then pass in references to implementations of those traits:
pub fn open_plog(config: Config, get_key: &impl KeyLoader, signer: &impl Signer) -> Result<Log, Error> {
// ...
}
The update operation in the bs crate has the same callbacks and should be updated as well.
DougAnderson444
Metadata
Metadata
Assignees
Labels
No labels