Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

candid asts as candid data #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

candid asts as candid data #161

wants to merge 1 commit into from

Conversation

matthewhammer
Copy link
Contributor

  • derive equality and cloning for ASTs of candid types (type IDLType and related types)
  • derive (binary) deserializer for ASTs of candid types
  • derive (binary) serializer for ASTs of candid types --- had trouble using the directive, because of a crate-path issue?

Back story

Note that this is asking for candid asts in Rust to be usable as candid data, not as a plaintext string. Plaintext forms for candid types are supported in Rust, but not in every language (not in Motoko). By converting these ASTs, as data, into candid binary form, we can send them to canisters that act on them as ASTs (as data, not as strings) and get these ASTs back without re-doing the pretty printer for candid types.

@@ -1,22 +1,33 @@
use crate::types::Label;
use crate::Result;
use pretty::RcDoc;
use crate::{CandidType, Deserialize};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chenyan-dfinity I tried to use CandidType below each place where I added Deserialize, but I got some macro errors. I think the issue is about the macro being used from the crate that defines it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant