7 releases
0.1.6 | Aug 2, 2020 |
---|---|
0.1.5 | Jul 17, 2020 |
0.1.4 | Jun 18, 2020 |
0.1.3 | May 23, 2020 |
0.1.0 | Mar 23, 2020 |
#53 in #entry
5KB
holochain_entry_utils
Holochain utilities crate around entries, implementing common behaviour and functions.
Usage
Add this dependency to your Cargo.toml
:
[dependencies]
holochain_entry_utils = "0.1.1"
Implement the HolochainEntry
trait:
use holochain_entry_utils::HolochainEntry;
#[derive(Serialize, Deserialize, Debug, DefaultJson, Clone)]
pub struct TestEntry {
contents: String,
}
impl HolochainEntry for TestEntry {
fn entry_type() -> String {
String::from("test_type")
}
}
pub fn entry_def() -> ValidatingEntryType {
entry!(
name: TestEntry::entry_type(),
...
}
And now the functions defined in the Trait (see documentation) are available for you to use:
pub fn test_function(test_entry: TestEntry) -> ZomeApiResult<Address> {
hdk::commit_entry(&test_entry.entry())
}
Dependencies
~18–28MB
~441K SLoC