Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
EricLBuehler committed Sep 9, 2023
1 parent 2700987 commit 2a24b90
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@ env:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [stable]

steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build
- uses: actions-rs/toolchain@v3
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v3
with:
commad: check

formatting:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "trc"
version = "1.2.2"
version = "1.2.3"
edition = "2021"
license = "MIT"
readme = "README.md"
Expand Down
39 changes: 38 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@ use std::{
hash::{Hash, Hasher},
mem::{forget, ManuallyDrop, MaybeUninit},
ops::Deref,
os::fd::{AsFd, AsRawFd},
panic::UnwindSafe,
pin::Pin,
ptr::{self, addr_of, addr_of_mut, slice_from_raw_parts_mut, write, NonNull},
};

#[cfg(not(target_os = "windows"))]
use std::os::fd::{AsFd, AsRawFd};

#[cfg(target_os = "windows")]
use std::os::windows::io::{AsRawHandle, AsRawSocket};

#[cfg(feature = "dyn_unstable")]
use std::any::Any;

Expand Down Expand Up @@ -1695,30 +1700,62 @@ impl<T: PartialEq> PartialEq for SharedTrc<T> {
}
}

#[cfg(not(target_os = "windows"))]
impl<T: AsFd> AsFd for Trc<T> {
fn as_fd(&self) -> std::os::fd::BorrowedFd<'_> {
(**self).as_fd()
}
}

#[cfg(not(target_os = "windows"))]
impl<T: AsFd> AsFd for SharedTrc<T> {
fn as_fd(&self) -> std::os::fd::BorrowedFd<'_> {
(**self).as_fd()
}
}

#[cfg(target_os = "windows")]
impl<T: AsRawHandle> AsRawHandle for Trc<T> {
fn as_raw_handle(&self) -> std::os::fd::BorrowedFd<'_> {
(**self).as_raw_handle()
}
}

#[cfg(target_os = "windows")]
impl<T: AsRawHandle> AsRawHandle for SharedTrc<T> {
fn as_raw_handle(&self) -> std::os::fd::BorrowedFd<'_> {
(**self).as_raw_handle()
}
}

#[cfg(not(target_os = "windows"))]
impl<T: AsRawFd> AsRawFd for Trc<T> {
fn as_raw_fd(&self) -> std::os::fd::RawFd {
(**self).as_raw_fd()
}
}

#[cfg(not(target_os = "windows"))]
impl<T: AsRawFd> AsRawFd for SharedTrc<T> {
fn as_raw_fd(&self) -> std::os::fd::RawFd {
(**self).as_raw_fd()
}
}

#[cfg(target_os = "windows")]
impl<T: AsRawSocket> AsRawSocket for Trc<T> {
fn as_raw_socket(&self) -> std::os::fd::BorrowedFd<'_> {
(**self).as_raw_socket()
}
}

#[cfg(target_os = "windows")]
impl<T: AsRawSocket> AsRawSocket for SharedTrc<T> {
fn as_raw_socket(&self) -> std::os::fd::BorrowedFd<'_> {
(**self).as_raw_socket()
}
}

#[allow(deprecated)]
impl<T: Error> Error for Trc<T> {
fn cause(&self) -> Option<&dyn Error> {
Expand Down

0 comments on commit 2a24b90

Please sign in to comment.