mirror of
https://codeberg.org/icewind/rfc7239.git
synced 2026-06-03 16:44:10 +02:00
feature gate no_std
This commit is contained in:
parent
b36dc994a1
commit
432d2393cb
3 changed files with 28 additions and 7 deletions
|
|
@ -11,3 +11,7 @@ rust-version = "1.56.1"
|
|||
|
||||
[dependencies]
|
||||
uncased = "0.9.10"
|
||||
|
||||
[features]
|
||||
std = []
|
||||
default = ["std"]
|
||||
|
|
@ -18,4 +18,10 @@ for node_result in parse(header_value) {
|
|||
}
|
||||
```
|
||||
|
||||
## `no_std`
|
||||
|
||||
This crate can be used in a `no_std` environment by disabling the default `std` feature.
|
||||
|
||||
The only impact disabling this feature has is using `core::error::Error` and `core::net::IpAddr` instead of the `std` variants and increasing the msrv to 1.81.
|
||||
|
||||
[rfc7239]: https://tools.ietf.org/html/rfc7239
|
||||
|
|
|
|||
25
src/lib.rs
25
src/lib.rs
|
|
@ -1,4 +1,5 @@
|
|||
#![no_std]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
//! Parser for [rfc7239] formatted `Forwarded` headers.
|
||||
//!
|
||||
//! ## Usage
|
||||
|
|
@ -23,15 +24,25 @@
|
|||
//!
|
||||
//! [rfc7239]: https://tools.ietf.org/html/rfc7239
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(test, not(feature = "std")))]
|
||||
extern crate std;
|
||||
#[cfg(test)]
|
||||
#[cfg(all(test, not(feature = "std")))]
|
||||
use std::{format, vec, vec::Vec};
|
||||
|
||||
use core::error::Error;
|
||||
use core::fmt::{Debug, Display, Formatter};
|
||||
use core::net::IpAddr;
|
||||
use core::str::FromStr;
|
||||
#[cfg(not(feature = "std"))]
|
||||
use core::{
|
||||
error::Error,
|
||||
fmt::{Debug, Display, Formatter},
|
||||
net::IpAddr,
|
||||
str::FromStr,
|
||||
};
|
||||
#[cfg(feature = "std")]
|
||||
use std::{
|
||||
error::Error,
|
||||
fmt::{Debug, Display, Formatter},
|
||||
net::IpAddr,
|
||||
str::FromStr,
|
||||
};
|
||||
use uncased::UncasedStr;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue