# Is it worth it to re-export some libraries in ic-cdk?

**URL:** <https://forum.dfinity.org/t/is-it-worth-it-to-re-export-some-libraries-in-ic-cdk/13114>\
**Category:** Developers\
**Created:** [May 19, 2022, 4:46am UTC](https://forum.dfinity.org/t/is-it-worth-it-to-re-export-some-libraries-in-ic-cdk/13114 "2022-05-19T04:46:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![flyq](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/flyq/32/3637_2.png) [@flyq](https://forum.dfinity.org/u/flyq)\
**Post date:** [May 19, 2022, 4:46am UTC](https://forum.dfinity.org/t/is-it-worth-it-to-re-export-some-libraries-in-ic-cdk/13114/1 "2022-05-19T04:46:44Z")

</div>

> <https://github.com/dfinity/cdk-rs/blob/d056a9cc8a/src/ic-cdk/src/lib.rs#L20-L25>

As we can see here, `ic-cdk` re-exports some library functions, mainly `candid` and `serde`.

I think if those crates are necessary for using `ic-cdk`, it would be much clearer to let canister developers import `candid` or `serde` directly by themselves.

1. When you want to use `ic-cdk`, you still have to import `candid` and `serde` in most cases.
2. And it’s annoying the compiler throws errors when you want to use only `candid` (I’m not sure if this is a bug of the rust compiler):

`[dependencies]` of `ic00_types` should only need `candid`, and `ic-cdk` is not imported in reality, but there are a lot of strange errors:

```nohighlight
   --> /Users/x/.cargo/git/checkouts/ic-55f61c774f0feae0/551408d/rs/types/ic00_types/src/lib.rs:997:10
    |
997 | #[derive(CandidType, Deserialize)]
    | ^^^^^^^^^^ not found in `ic_cdk::export::candid::types`
    |
    = note: this error originates in the derive macro `CandidType` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
    |
5 | use candid::types::TypeId;
    |
5 | use core::any::TypeId;
    |
5 | use std::any::TypeId;
    |
help: if you import `TypeId`, refer to it directly
    |
997 - #[derive(CandidType, Deserialize)]
997 + #[derive(CandidType, Deserialize)]
    | 

error[E0433]: failed to resolve: could not find `ic_cdk` in the list of imported crates

```

> <https://github.com/dfinity/ic/blob/82cee199ca/rs/types/ic00_types/src/lib.rs#L1007>

Since the open source of the ic repo in May last year, when importing the library of the ic repo as a dependency into other projects, I have often received this problem.

---

<div class="post-metadata">

**Author:** ![paulyoung](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulyoung/32/5251_2.png) [@paulyoung](https://forum.dfinity.org/u/paulyoung)\
**Post date:** [May 19, 2022, 5:05am UTC](https://forum.dfinity.org/t/is-it-worth-it-to-re-export-some-libraries-in-ic-cdk/13114/2 "2022-05-19T05:05:20Z")

</div>

There’s a note somewhere which says:

> Note that if you are using the Rust CDK to develop Rust canisters, it is encouraged to use the Candid crate from `ic_cdk::export::candid` to avoid version mismatch.
