Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on winapi 0.2 #25

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be #[repr(C)] here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, missed that, damn. will do PR

pub len: ULONG,
pub buf: *mut CHAR,
}

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