Coding
PromptBeginner5 minmarkdown
Markdown Converter
Agent skill for markdown-converter
7
iRPC is a Rust library providing a robotic node interaction protocol that supports both standard host environments and no_std embedded environments through feature-gated architecture.
Sign in to like and favorite skills
iRPC is a Rust library providing a robotic node interaction protocol that supports both standard host environments and no_std embedded environments through feature-gated architecture.
arm_api feature: Enables std environment support with async runtime (tokio) and logging (tracing)joint_api feature: Enables no_std embedded environment support with synchronous APIs#![cfg_attr(not(feature = "arm_api"), no_std)] for no_std compatibilityconst fn constructors for embedded-friendly APIsResult<T, ProtocolError> for all fallible operationsClone and Debug for data types when possibleWhen adding std-only code:
#[cfg(feature = "arm_api")] use std::vec::Vec; #[cfg(feature = "arm_api")] use tokio::sync::mpsc;
When adding no_std code:
#[cfg(not(feature = "arm_api"))] extern crate alloc; #[cfg(not(feature = "arm_api"))] use alloc::vec::Vec;
For universal code:
// Import std types when arm_api feature is enabled, otherwise use no_std alternatives #[cfg(feature = "arm_api")] use std::vec::Vec; #[cfg(feature = "arm_api")] use std::string::String; #[cfg(not(feature = "arm_api"))] extern crate alloc; #[cfg(not(feature = "arm_api"))] use alloc::vec::Vec; #[cfg(not(feature = "arm_api"))] use alloc::string::String;
const constructors where possible: pub const fn new() -> Selfbuffer: [u8; 256]try_receive() instead of receive()--no-default-features --features joint_apiasync fn for I/O operations in std environmentstokio::sync primitives over std::synctracing for logging instead of println!Result<T, ProtocolError> from async functions#[tokio::test]ProtocolError enum for all library errorsProtocolError::IoError(String)Result types#[cfg(feature = "arm_api")] and #[cfg(feature = "joint_api")]cargo test --no-default-features --features arm_apicargo test --no-default-features --features joint_apicargo test --features arm_api,joint_api/// Available only with the arm_api feature.#[doc(cfg(feature = "..."))] for feature-gated itemsprotocol.rs: Core protocol definitions (universal)bus.rs: Communication bus abstractions (universal)arm.rs: Host environment APIs (arm_api feature only)joint.rs: Embedded environment APIs (joint_api feature only)#[inline] for hot path functionscore and alloc over std in universal code