Stream: beginners

Topic: How to use roc glue?


view this post on Zulip Kilian Vounckx (May 17 2023 at 15:03):

I am trying to write a platform just to try it out. I am using rust, because it has the most examples.
I can't figure out how to use roc glue. If I understand correctly, it 'translates' the types you created in roc to rust, so you can use them in functions in rust. Is this correct? If not, what does it do then? If yes, how to use it correctly?
If I run roc glue --help, I see I have to provide a GLUE_SPEC but what is this?

view this post on Zulip Brendan Hansknecht (May 17 2023 at 15:11):

https://github.com/roc-lang/roc/blob/main/crates/glue/src/RustGlue.roc

view this post on Zulip Brendan Hansknecht (May 17 2023 at 15:12):

That is the spec for rust

view this post on Zulip Brendan Hansknecht (May 17 2023 at 15:14):

glue can help some currently, but still has a lot of limitations. A big part of the issue is that we plan to change how platforms work (glue is designed for the new flow). That said, overall, it should be helpful, just may take a bit of messing around to get it fully working (though that may have changed some recently with work from others)

view this post on Zulip Brendan Hansknecht (May 17 2023 at 15:14):

A bunch of example platforms that work with glue live here: https://github.com/roc-lang/roc/tree/main/crates/glue/tests/fixtures

They are just our test cases.

view this post on Zulip Kilian Vounckx (May 17 2023 at 15:22):

Thanks! With the spec it worked. Still had to figure some stuff out, but I got a rust file. I will try it out now


Last updated: Jul 06 2025 at 12:14 UTC