Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: smoltcp-rs/smoltcp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 908f70957b33
Choose a base ref
...
head repository: smoltcp-rs/smoltcp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d866cc7721b4
Choose a head ref
  • 2 commits
  • 8 files changed
  • 1 contributor

Commits on Mar 5, 2017

  1. Remove the use_ prefix from feature names.

    I haven't realized that a feature `log` with an optional crate
    dependency `log` activates that dependency, and added the prefix
    to avoid a "clash". This is unnecessary.
    whitequark committed Mar 5, 2017
    Copy the full SHA
    a155269 View commit details
  2. Copy the full SHA
    d866cc7 View commit details
Showing with 35 additions and 35 deletions.
  1. +5 −5 .travis.yml
  2. +6 −6 Cargo.toml
  3. +8 −8 README.md
  4. +2 −2 src/iface/arp_cache.rs
  5. +7 −7 src/lib.rs
  6. +5 −5 src/phy/mod.rs
  7. +1 −1 src/phy/tracer.rs
  8. +1 −1 src/socket/set.rs
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -2,15 +2,15 @@ language: rust
matrix:
include:
- rust: stable
env: FEATURES='use_std' MODE='test'
env: FEATURES='std' MODE='test'
- rust: beta
env: FEATURES='use_std' MODE='test'
env: FEATURES='std' MODE='test'
- rust: nightly
env: FEATURES='use_std' MODE='test'
env: FEATURES='std' MODE='test'
- rust: nightly
env: FEATURES='use_std use_log' MODE='test'
env: FEATURES='std log' MODE='test'
- rust: nightly
env: FEATURES='use_alloc use_collections' MODE='build'
env: FEATURES='alloc collections' MODE='build'
- rust: nightly
env: FEATURES='' MODE='build'
allow_failures:
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -8,11 +8,12 @@ homepage = "https://github.com/m-labs/smoltcp"
repository = "https://github.com/m-labs/smoltcp.git"
readme = "README.md"
keywords = ["ip", "tcp", "udp", "ethernet", "network"]
categories = ["embedded"]
license = "0BSD"

[dependencies]
byteorder = { version = "1.0", default-features = false }
managed = { version = "0.2.1", default-features = false }
managed = { version = "0.3.0", default-features = false }
log = { version = "0.3", default-features = false, optional = true }
libc = { version = "0.2.18", optional = true }

@@ -22,12 +23,11 @@ env_logger = "0.4"
getopts = "0.2"

[features]
use_std = ["managed/use_std", "libc"]
use_alloc = ["managed/use_alloc"]
use_collections = ["managed/use_collections"]
use_log = ["log"]
std = ["managed/std", "libc"]
alloc = ["managed/alloc"]
collections = ["managed/collections"]
verbose = []
default = ["use_std", "use_log", "verbose"]
default = ["std", "log", "verbose"]

[[example]]
name = "tcpdump"
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -82,27 +82,27 @@ You probably want to disable default features and configure them one by one:
smoltcp = { version = ..., default-features = false, features = [...] }
```

### Feature `use_std`
### Feature `std`

The `use_std` feature enables use of objects and slices owned by the networking stack through a
The `std` feature enables use of objects and slices owned by the networking stack through a
dependency on `std::boxed::Box` and `std::vec::Vec`. It also enables `smoltcp::phy::RawSocket`
and `smoltcp::phy::TapInterface`, if the platform supports it.

This feature is enabled by default.

### Feature `use_alloc`
### Feature `alloc`

The `use_alloc` feature enables use of objects owned by the networking stack through a dependency
The `alloc` feature enables use of objects owned by the networking stack through a dependency
on `alloc::boxed::Box`. This only works on nightly rustc.

### Feature `use_collections`
### Feature `collections`

The `use_collections` feature enables use of slices owned by the networking stack through a dependency
The `collections` feature enables use of slices owned by the networking stack through a dependency
on `collections::vec::Vec`. This only works on nightly rustc.

### Feature `use_log`
### Feature `log`

The `use_log` feature enables logging of events within the networking stack through
The `log` feature enables logging of events within the networking stack through
the [log crate][log]. The events are emitted with the TRACE log level.

[log]: https://crates.io/crates/log
4 changes: 2 additions & 2 deletions src/iface/arp_cache.rs
Original file line number Diff line number Diff line change
@@ -67,12 +67,12 @@ impl<'a> SliceCache<'a> {

/// Sort entries in an order suitable for `find`.
fn sort(&mut self) {
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
fn sort(data: &mut [(IpAddress, EthernetAddress, usize)]) {
data.sort_by_key(|&(key, _, _)| key)
}

#[cfg(not(feature = "use_std"))]
#[cfg(not(feature = "std"))]
fn sort(data: &mut [(IpAddress, EthernetAddress, usize)]) {
// Use an insertion sort, which performs best on 10 elements and less.
for i in 1..data.len() {
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg_attr(feature = "use_alloc", feature(alloc))]
#![cfg_attr(feature = "alloc", feature(alloc))]
#![no_std]

//! The _smoltcp_ library is built in a layered structure, with the layers corresponding
@@ -69,22 +69,22 @@
extern crate byteorder;
extern crate managed;
#[cfg(any(test, feature = "use_std"))]
#[cfg(any(test, feature = "std"))]
#[macro_use]
extern crate std;
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
extern crate libc;
#[cfg(feature = "use_alloc")]
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(any(test, feature = "use_log"))]
#[cfg(any(test, feature = "log"))]
#[macro_use(trace, log)]
extern crate log;

macro_rules! net_trace {
($($arg:expr),*) => {
#[cfg(feature = "use_log")]
#[cfg(feature = "log")]
trace!($($arg),*);
#[cfg(not(feature = "use_log"))]
#[cfg(not(feature = "log"))]
$( let _ = $arg );*; // suppress unused variable warnings
}
}
10 changes: 5 additions & 5 deletions src/phy/mod.rs
Original file line number Diff line number Diff line change
@@ -97,21 +97,21 @@ impl Drop for EthernetTxBuffer {

use Error;

#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
mod sys;

mod tracer;
mod fault_injector;
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
mod raw_socket;
#[cfg(all(feature = "use_std", target_os = "linux"))]
#[cfg(all(feature = "std", target_os = "linux"))]
mod tap_interface;

pub use self::tracer::Tracer;
pub use self::fault_injector::FaultInjector;
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
pub use self::raw_socket::RawSocket;
#[cfg(all(feature = "use_std", target_os = "linux"))]
#[cfg(all(feature = "std", target_os = "linux"))]
pub use self::tap_interface::TapInterface;

/// An interface for sending and receiving raw network frames.
2 changes: 1 addition & 1 deletion src/phy/tracer.rs
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ impl<T: Device, U: PrettyPrint> Tracer<T, U> {
}

/// Create a tracer device, printing to standard output.
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
pub fn new_stdout(lower: T) -> Tracer<T, U> {
fn writer<U: PrettyPrint>(printer: PrettyPrinter<U>) {
print!("{}", printer)
2 changes: 1 addition & 1 deletion src/socket/set.rs
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ impl<'a, 'b: 'a, 'c: 'a + 'b> Set<'a, 'b, 'c> {
ManagedSlice::Borrowed(_) => {
panic!("adding a socket to a full SocketSet")
}
#[cfg(any(feature = "use_std", feature = "use_collections"))]
#[cfg(any(feature = "std", feature = "collections"))]
ManagedSlice::Owned(ref mut sockets) => {
sockets.push(None);
let index = sockets.len() - 1;