[][src]Function hdk::api::entry_address

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

Reconstructs an address of the given entry data. This is the same value that would be returned if entry_type_name and entry_value were passed to the commit_entry function and by which it would be retrievable from the DHT using get_entry. This is often used to reconstruct an address of a base argument when calling get_links.

Examples

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

pub fn handle_post_address(content: String) -> ZomeApiResult<Address> {
    let post_entry = Entry::App("post".into(), Post {
        content,
        date_created: "now".into(),
    }.into());

    hdk::entry_address(&post_entry)
}