Expected struct HoloHash, found enum Result

Hello
I have the following code:

#[hdk_extern]
pub fn create_entry_community(community: CommunityInput) -> ExternResult<CommunityOutput> {
  let my_pub_key: AgentPubKey = agent_info()?.agent_latest_pubkey;
 
 
  let comm = Community {
    name: community.name.clone(),
    creator: my_pub_key,
  };
 
  let community_revision_id: ActionHash = create_entry(&EntryTypes::Community(comm.clone()))?;
  let community_id = hash_entry(&comm);
 
  let comm_output = CommunityOutput {
    community_id: community_id.clone(),
    community_revision_id: community_revision_id.clone(),
 
  };
 
  Ok(comm_output)
}

and what I get as an error:

> test
> npm run build:happ && npm t -w tests
 
 
> build:happ
> npm run build:dnas && hc app pack ./workdir
 
 
> build:dnas
> npm run build:zomes && hc dna pack ./dna/workdir
 
 
> build:zomes
> CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown
 
   Compiling zome_0 v0.0.1 (/home/vlada/Documents/holob/peggie/dna/coordinator_zomes/zome_0)
error[E0308]: mismatched types
  --> dna/coordinator_zomes/zome_0/src/entry_def_0.rs:32:19
   |
32 |     community_id: community_id.clone(),
   |                   ^^^^^^^^^^^^^^^^^^^^ expected struct `HoloHash`, found enum `Result`
   |
   = note: expected struct `HoloHash<_>`
                found enum `Result<HoloHash<_>, hdk::prelude::WasmError>`
 
For more information about this error, try `rustc --explain E0308`.
error: could not compile `zome_0` due to previous error

Solved. I had to put .unwrap() method on community_id.

1 Like