agent-rs icon indicating copy to clipboard operation
agent-rs copied to clipboard

support `no_std`

Open smallstepman opened this issue 1 year ago • 2 comments

A user asked a question on the forum https://forum.dfinity.org/t/about-iot-using-dfinity/14518

Is it currently possible to compile ic-agent with no_std flag?

smallstepman avatar Jul 25 '22 13:07 smallstepman

You need an operating system to have a network socket. We are not about to implement a network card driver for ic-agent. IoT devices typically have an androidlike operating system, so a no-std mode would not be necessary either.

adamspofford-dfinity avatar Aug 02 '22 15:08 adamspofford-dfinity

no one is talking about implementing network card drivers here ;p

could you link the "IoT androidlike OS" you're referring to?

I can't think of a straightforward way to install ic-agent on something like RPi Pico. I guess the first thing I'd try is to install ZephyrOS and then try to somehow add ic-agent to the mix, although I'd still have to bridge C++ and Rust. I'm not sure if/how Zephyr would be able to expose the network socket from C++ to Rust ic-agent.

Perhaps it would be a good idea to put network stuff behind feature flags? Then flag with pub all functions that generate (or interpret) the content of network requests. What do you think?

Another option would be to split ic-agent into

  • ic-agent-core - cryptography, generation/interpretation of network requests/responses
  • ic-agent-network-wrapper-what-a-great-name = ic-agent-core + hyper-rustls + async

smallstepman avatar Aug 02 '22 16:08 smallstepman