Skip to content

Commit

Permalink
Remove dependency on winapi 0.2 (#25)
Browse files Browse the repository at this point in the history
Instead declare the few types we use directly in the crate to avoid bringing in the old winapi 0.2 dependency.

Fixes #16.
Replaces previous attempts #19 #22 #24.
  • Loading branch information
repi authored and carllerche committed Oct 9, 2019
1 parent d13b80c commit d564f78
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sudo: false
matrix:
include:
# Oldest supported Rust (this should track Mio)
- rust: 1.9.0
- rust: 1.18.0
- rust: stable
# OS X support
- rust: stable
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.1.3 (September 20th, 2019)

* Remove dependency on old winapi 0.2 (#16)

# 0.1.2 (January 26th, 2018)

* Add support for non-windows/unix targets (#10)
Expand Down
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iovec"
version = "0.1.2"
version = "0.1.3"
authors = ["Carl Lerche <me@carllerche.com>"]
license = "MIT/Apache-2.0"
readme = "README.md"
Expand All @@ -15,6 +15,3 @@ categories = ["network-programming", "api-bindings"]

[target.'cfg(unix)'.dependencies]
libc = "0.2"

[target.'cfg(windows)'.dependencies]
winapi = "0.2"
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
#[cfg(unix)]
extern crate libc;

#[cfg(windows)]
extern crate winapi;

mod sys;

use std::{ops, mem};
Expand Down
13 changes: 12 additions & 1 deletion src/sys/windows.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
use winapi::{WSABUF, DWORD};
use std::{mem, slice, u32};

// declare the types we need directly here to avoid bringing
// in the old and slow winapi 0.2 dependency.

type DWORD = u32;
type ULONG = u32;
type CHAR = i8;

struct WSABUF {
pub len: ULONG,
pub buf: *mut CHAR,
}

pub struct IoVec {
inner: [u8],
}
Expand Down

0 comments on commit d564f78

Please sign in to comment.