Skip to content

Commit

Permalink
Feature std added
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhakansson committed Mar 15, 2024
1 parent 22cf136 commit 3f4eae6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ rand = { version = "0.8.5", optional = true}
[features]
serde = ["sd","tinyvec/serde"]
test_gen = ["rand"]
default = ["all_msgs"]
std = []
default = ["all_msgs","std"]
all_msgs = [
"msg1001",
"msg1002",
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ rtcm-rs = { version = "0.9.0", features=["serde"] }
rtcm-rs = { version = "0.9.0", default-features=false, features=["msg1001","msg1005"] }
```

- `no_std`: To disable the standard library, make sure to set default-features to false.
*Disabling the standard library only has the effect of type RtcmError not implementing the Error trait. No dynamic memory allocations are made regardless of whether the standard library is enabled or not*
```toml
rtcm-rs = { version = "0.9.0", default-features=false }
```

- `test_gen`: This feature is used exclusively for generating tests during library development and is not necessary for library usage.

## Usage
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
//!
//! For a full list of features and capabilities, see the [README](https://github.com/martinhakansson/rtcm-rs/blob/master/README.md).

#![no_std]
// #![no_std]
#![cfg_attr(not(feature = "std"), no_std)]
#![forbid(unsafe_code)]
//use message::{Message, MessageBuilder};
//use preamble::MessageFrame;
Expand Down
4 changes: 3 additions & 1 deletion src/rtcm_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ impl core::fmt::Display for RtcmError {
}
}
}
//should Error implementation be hidden behind a std feature guard?

#[cfg(feature = "std")]
impl std::error::Error for RtcmError {}

0 comments on commit 3f4eae6

Please sign in to comment.