I'm building a library to be used on a no_std
platform which allows you to do some common network-related IO, such as making HTTP requests or reading from/writing to Websockets.
(我正在构建一个在no_std
平台上使用的库,该库允许您执行一些与网络相关的常见IO,例如发出HTTP请求或从Websocket读取/写入。)
Now, I would like this library to be a well-behaved citizen so that it can be easily included in other no_std
applications.
(现在,我希望这个库成为一个行为良好的公民,以便可以轻松地将其包含在其他no_std
应用程序中。)
I hence want to package the library by implementing reasonable traits etc. The library would allow me to not have to use alloc
, so supporting non- alloc
no_std
would be ideal. (因此,我想通过实现合理的特性等来打包该库。该库将使我不必使用alloc
,因此支持non- alloc
no_std
是理想的选择。)
These are the options I have looked at:
(这些是我看过的选项:)
-
embedded_hal
and nb
: These crates are really low level (no generic traits like Read
and Write
or anything higher level) and the async model doesn't seem to be compatible with async/await
(embedded_hal
和nb
:这些箱子是非常低的水平(如没有通用特征Read
和Write
和异步模式或任何更高级别的)似乎并没有与之兼容async/await
)
-
genio
/ core_io
/...: These don't support async IO at all. (genio
/ core_io
/ ...:这些根本不支持异步IO。)
-
embrio
: Seems interesting but it seems like using it would tie me to one specific environment, making the library less portable. (embrio
:似乎很有趣,但似乎使用它会使我绑定到一个特定的环境,从而使库的可移植性降低。)
-
tokio
v0.2.x: I would love to use it but there is no no_std
support at all. (tokio
v0.2.x:我很想使用它,但是根本没有no_std
支持。)
-
futures::io
v0.3.x: Again, would love to use it but there is no no_std
support. (futures::io
v0.3.x:同样,很想使用它,但没有no_std
支持。)
Which async IO abstraction should I use in a no_std environment?
(我应该在no_std环境中使用哪个异步IO抽象?)
If there is no good option right now, which one should I bet on/help out with for the future? (如果目前没有好的选择,那么我应该为未来打赌/提供帮助吗?)
ask by dflemstr translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…