hdk/
clone.rs

1use crate::prelude::HDK;
2use hdi::map_extern::ExternResult;
3use holochain_zome_types::clone::{
4    ClonedCell, CreateCloneCellInput, DeleteCloneCellInput, DisableCloneCellInput,
5    EnableCloneCellInput,
6};
7
8/// Create a new cell in the current app based on the DNA of an existing cell in this app.
9///
10/// # Returns
11///
12/// A struct with the created cell's clone id and cell id.
13pub fn create_clone_cell(input: CreateCloneCellInput) -> ExternResult<ClonedCell> {
14    HDK.with(|h| h.borrow().create_clone_cell(input))
15}
16
17/// Disable a clone cell in the current app.
18pub fn disable_clone_cell(input: DisableCloneCellInput) -> ExternResult<()> {
19    HDK.with(|h| h.borrow().disable_clone_cell(input))
20}
21
22/// Enable a disabled clone cell in the current app.
23///
24/// # Returns
25///
26/// A struct with the enabled cell's clone id and cell id.
27pub fn enable_clone_cell(input: EnableCloneCellInput) -> ExternResult<ClonedCell> {
28    HDK.with(|h| h.borrow().enable_clone_cell(input))
29}
30
31/// Delete a clone cell in the current app.
32pub fn delete_clone_cell(input: DeleteCloneCellInput) -> ExternResult<()> {
33    HDK.with(|h| h.borrow().delete_clone_cell(input))
34}