[][src]Function hdk::api::commit_entry

pub fn commit_entry(entry: &Entry) -> ZomeApiResult<Address>

Attempts to commit an entry to your local source chain. The entry will have to pass the defined validation rules for that entry type. If the entry type is defined as public, will also publish the entry to the DHT. Returns either an address of the committed entry as a string, or an error.


#[derive(Serialize, Deserialize, Debug, DefaultJson)]
pub struct Post {
    content: String,
    date_created: String,

pub fn handle_create_post(content: String) -> ZomeApiResult<Address> {

    let post_entry = Entry::App("post".into(), Post{
        date_created: "now".into(),

   let address = hdk::commit_entry(&post_entry)?;