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]
|
[dependencies]
|
||||||
uncased = "0.9.10"
|
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
|
[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.
|
//! Parser for [rfc7239] formatted `Forwarded` headers.
|
||||||
//!
|
//!
|
||||||
//! ## Usage
|
//! ## Usage
|
||||||
|
|
@ -23,15 +24,25 @@
|
||||||
//!
|
//!
|
||||||
//! [rfc7239]: https://tools.ietf.org/html/rfc7239
|
//! [rfc7239]: https://tools.ietf.org/html/rfc7239
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(all(test, not(feature = "std")))]
|
||||||
extern crate std;
|
extern crate std;
|
||||||
#[cfg(test)]
|
#[cfg(all(test, not(feature = "std")))]
|
||||||
use std::{format, vec, vec::Vec};
|
use std::{format, vec, vec::Vec};
|
||||||
|
|
||||||
use core::error::Error;
|
#[cfg(not(feature = "std"))]
|
||||||
use core::fmt::{Debug, Display, Formatter};
|
use core::{
|
||||||
use core::net::IpAddr;
|
error::Error,
|
||||||
use core::str::FromStr;
|
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;
|
use uncased::UncasedStr;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue