rtcm-rs
rtcm-rs is a powerful Rust library for decoding and encoding RTCM version 3 messages as defined in the RTCM Standard 10403.x. As of now, it supports a subset of the messages in the standard, but work is being done to cover them all in the near future.
In the spirit of Rust's safety principles, this library is developed with #[forbid(unsafe_code)], ensuring that all operations are safe from undefined behavior, data races, and many common bugs. Thus, you can rely on rtcm-rs for not only its functionality but also its commitment to safety.
This library provides robust support for Serde, a powerful serialization/deserialization framework, facilitating conversion of RTCM messages into other formats such as JSON, XML and more. For an example of this functionality, see the rtcm-json project.
Moreover, the library is no_std
compatible and doesn't rely on dynamic memory allocations, making it suitable for use in embedded environments. With feature flags for each message type, rtcm-rs can be tailored to your needs, reducing library size when necessary.
Features
serde
: For adding support for serialization and deserialization. To enable this, add the following to the rtcm-rs dependency in your Cargo.toml file:
= { =0.1.1, features=["serde"] }
- Selective message support: To minimize the library size by supporting only certain RTCM messages. For instance, to only support messages 1004 and 1005, update your Cargo.toml as follows:
= { =0.1.1, default-features=false, features=["msg1004","msg1005"] }
test_gen
: This feature is used exclusively for generating tests during library development and is not necessary for library usage.
Usage
To add rtcm-rs to your project, add the following to your Cargo.toml
file:
[]
= "0.1.1"
Remember that hyphenated crate names translate to underscored crate names in rust source code, i.e. rtcm_rs
for this crate. For instance, add the following to import from the prelude:
use *;
Examples
Here are some examples of how to decode and encode RTCM messages using this library:
Basic RTCM message decoding
use *;
use Read;
Using iterator functionality for decoding multiple RTCM messages
use *;
use Read;
Encoding a RTCM message
use *;
use ;
use DataVec;
In this third example, we demonstrate how to encode an RTCM message. We start by initializing a new MessageBuilder
instance and then use its build_message
method to construct a new RTCM message. If the message is successfully built, the resulting byte array representing the message is printed. This example shows how to create and encode a complex RTCM message containing satellite information.
License
MIT or Apache-2.0