Skip to content

Commit

Permalink
Use stabilized ip_in_core feature
Browse files Browse the repository at this point in the history
  • Loading branch information
newAM committed Mar 22, 2024
1 parent 2ad0b03 commit 8ee9ac3
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

include:
# Test MSRV
- rust: 1.60.0
- rust: 1.77.0
TARGET: x86_64-unknown-linux-gnu

# Test nightly but don't fail
Expand All @@ -42,7 +42,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust: [nightly-2023-11-01]
rust: [stable]
TARGET:
[x86_64-unknown-linux-gnu, thumbv6m-none-eabi, thumbv7m-none-eabi]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-11-01
toolchain: stable
components: rustfmt
- run: cargo fmt --all -- --check
working-directory: embedded-nal-async
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

No unreleased changes yet
- Bump MSRV to 1.77.0 for `ip_in_core`.
- Removed the `no-std-net` and `ip_in_core` features, `ip_in_core` is now the default.

## [0.8.0] - 2023-11-10

Expand Down
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,5 @@ readme = "README.md"
keywords = ["network"]
categories = ["embedded", "hardware-support", "no-std", "network-programming"]

[features]
default = ["no-std-net"]
ip_in_core = []

[dependencies]
nb = "1"
no-std-net = { version = "0.6", optional = true }
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ These issues / PRs will be labeled as `proposal`s in the issue tracker.

## Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.60.0 and up. It _might_
This crate is guaranteed to compile on stable Rust 1.77.0 and up. It _might_
compile with older versions but that may change in any new patch release.

## License
Expand Down
2 changes: 1 addition & 1 deletion embedded-nal-async/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

No unreleased changes yet.
- Removed the `ip_in_core` feature, this is now the default.

## [0.7.1] - 2023-11-28

Expand Down
4 changes: 0 additions & 4 deletions embedded-nal-async/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ readme = "README.md"
keywords = ["network"]
categories = ["embedded", "hardware-support", "no-std", "network-programming", "asynchronous"]

[features]
ip_in_core = []

[dependencies]
no-std-net = "0.6"
embedded-nal = { version = "0.8.0", path = "../" }
embedded-io-async = { version = "0.6.0" }
18 changes: 0 additions & 18 deletions embedded-nal-async/build.rs

This file was deleted.

2 changes: 1 addition & 1 deletion embedded-nal-async/src/dns.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::IpAddr;
use core::net::IpAddr;
use embedded_nal::AddrType;

/// This trait is an extension trait for [`TcpStack`] and [`UdpStack`] for dns
Expand Down
8 changes: 0 additions & 8 deletions embedded-nal-async/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
//! # embedded-nal-async - An async Network Abstraction Layer for Embedded Systems

#![no_std]
#![cfg_attr(nightly, allow(stable_features, unknown_lints))]
#![cfg_attr(nightly, feature(async_fn_in_trait, impl_trait_projections))]
#![allow(async_fn_in_trait)]
#![deny(missing_docs)]
#![deny(unsafe_code)]
#![cfg_attr(feature = "ip_in_core", feature(ip_in_core))]

mod dns;
mod stack;

#[cfg(feature = "ip_in_core")]
pub use core::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
#[cfg(not(feature = "ip_in_core"))]
pub use no_std_net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};

pub use dns::Dns;
pub use embedded_nal::AddrType;
pub use stack::TcpConnect;
Expand Down
2 changes: 1 addition & 1 deletion embedded-nal-async/src/stack/tcp.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::SocketAddr;
use core::net::SocketAddr;

/// This trait is implemented by TCP/IP stacks. The trait allows the underlying driver to
/// construct multiple connections that implement the I/O traits from embedded-io-async.
Expand Down
4 changes: 2 additions & 2 deletions embedded-nal-async/src/stack/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! Implementing `UniquelyBound` and `MultiplyBound` with the same type is expected to be a
//! common choice.

use crate::SocketAddr;
use core::net::SocketAddr;

/// This trait is implemented by UDP sockets.
///
Expand Down Expand Up @@ -140,7 +140,7 @@ pub trait UdpStack {
&self,
remote: SocketAddr,
) -> Result<(SocketAddr, Self::Connected), Self::Error> {
use crate::{Ipv4Addr, Ipv6Addr, SocketAddr::*, SocketAddrV4, SocketAddrV6};
use core::net::{Ipv4Addr, Ipv6Addr, SocketAddr::*, SocketAddrV4, SocketAddrV6};

let local = match remote {
V4(_) => V4(SocketAddrV4::new(Ipv4Addr::UNSPECIFIED, 0)),
Expand Down
2 changes: 1 addition & 1 deletion src/dns.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::IpAddr;
use core::net::IpAddr;

/// This is the host address type to be returned by `gethostbyname`.
///
Expand Down
9 changes: 0 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,12 @@
#![no_std]
#![deny(missing_docs)]
#![deny(unsafe_code)]
#![cfg_attr(feature = "ip_in_core", feature(ip_in_core))]

mod dns;
mod stack;

pub use nb;

#[cfg(not(any(feature = "ip_in_core", feature = "no-std-net")))]
compile_error!("You must select the ip_in_core feature or the no-std-net feature");

#[cfg(feature = "ip_in_core")]
pub use core::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
#[cfg(not(feature = "ip_in_core"))]
pub use no_std_net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};

pub use dns::{AddrType, Dns};
pub use stack::{
SharableStack, SharedStack, TcpClientStack, TcpError, TcpErrorKind, TcpFullStack,
Expand Down
6 changes: 4 additions & 2 deletions src/stack/share.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{nb, SocketAddr, TcpClientStack, TcpFullStack, UdpClientStack, UdpFullStack};
use crate::{nb, TcpClientStack, TcpFullStack, UdpClientStack, UdpFullStack};
use core::cell::RefCell;
use core::net::SocketAddr;

/// Sharable wrapper for a network stack implementation.
///
Expand All @@ -12,7 +13,8 @@ use core::cell::RefCell;
///
/// ```
/// use embedded_nal::SharableStack;
/// # use embedded_nal::{UdpClientStack, SocketAddr, SocketAddrV4, Ipv4Addr, nb};
/// use core::net::{SocketAddr, SocketAddrV4, Ipv4Addr};
/// # use embedded_nal::{UdpClientStack, nb};
/// # struct SomeNalDriver {}
/// # impl SomeNalDriver {
/// # fn new() -> Self { Self {} }
Expand Down
2 changes: 1 addition & 1 deletion src/stack/tcp.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::SocketAddr;
use core::net::SocketAddr;

/// Represents specific errors encountered during TCP operations.
#[non_exhaustive]
Expand Down
2 changes: 1 addition & 1 deletion src/stack/udp.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::SocketAddr;
use core::net::SocketAddr;

/// This trait is implemented by UDP/IP stacks. You could, for example, have
/// an implementation which knows how to send AT commands to an ESP8266 WiFi
Expand Down

0 comments on commit 8ee9ac3

Please sign in to comment.