Skip to content

Commit ffa1ab7

Browse files
kinire98zkat
andauthored
fix(sync): Added the feature flags for compilation without the async runtime. Fixes #64. (#65)
BREAKING CHANGE: this bumps the MSRV to 1.70.0 --------- Co-authored-by: Kat Marchán <[email protected]>
1 parent 0ac9fb8 commit ffa1ab7

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ${{ matrix.os }}
2929
strategy:
3030
matrix:
31-
rust: [1.67.0, stable]
31+
rust: [1.70.0, stable]
3232
os: [ubuntu-latest, macOS-latest, windows-latest]
3333

3434
steps:

src/content/read.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ use std::pin::Pin;
66
#[cfg(any(feature = "async-std", feature = "tokio"))]
77
use std::task::{Context, Poll};
88

9-
#[cfg(feature = "async-std")]
10-
use futures::io::AsyncReadExt;
11-
#[cfg(feature = "tokio")]
12-
use tokio::io::AsyncReadExt;
9+
#[cfg(any(feature = "async-std", feature = "tokio"))]
10+
use crate::async_lib::AsyncReadExt;
1311

1412
use ssri::{Algorithm, Integrity, IntegrityChecker};
1513

@@ -162,6 +160,7 @@ pub fn reflink(cache: &Path, sri: &Integrity, to: &Path) -> Result<()> {
162160
reflink_unchecked(cache, sri, to)
163161
}
164162

163+
#[cfg(any(feature = "async-std", feature = "tokio"))]
165164
pub async fn reflink_async(cache: &Path, sri: &Integrity, to: &Path) -> Result<()> {
166165
let mut reader = open_async(cache, sri.clone()).await?;
167166
let mut buf = [0u8; 1024 * 8];

src/get.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ where
319319
/// Ok(())
320320
/// }
321321
/// ```
322+
#[cfg(any(feature = "async-std", feature = "tokio"))]
322323
pub async fn reflink<P, K, Q>(cache: P, key: K, to: Q) -> Result<()>
323324
where
324325
P: AsRef<Path>,
@@ -355,6 +356,7 @@ where
355356
/// Ok(())
356357
/// }
357358
/// ```
359+
#[cfg(any(feature = "async-std", feature = "tokio"))]
358360
pub async fn reflink_unchecked<P, K, Q>(cache: P, key: K, to: Q) -> Result<()>
359361
where
360362
P: AsRef<Path>,
@@ -391,6 +393,7 @@ where
391393
/// Ok(())
392394
/// }
393395
/// ```
396+
#[cfg(any(feature = "async-std", feature = "tokio"))]
394397
pub async fn reflink_hash<P, Q>(cache: P, sri: &Integrity, to: Q) -> Result<()>
395398
where
396399
P: AsRef<Path>,

src/index.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ impl RemoveOpts {
414414
}
415415

416416
/// Removes an individual index metadata entry. The associated content will be left in the cache.
417+
#[cfg(any(feature = "async-std", feature = "tokio"))]
417418
pub async fn remove<P, K>(self, cache: P, key: K) -> Result<()>
418419
where
419420
P: AsRef<Path>,

src/linkto.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#[cfg(any(feature = "async-std", feature = "tokio"))]
22
use crate::async_lib::AsyncRead;
3+
#[cfg(any(feature = "async-std", feature = "tokio"))]
4+
use crate::async_lib::AsyncReadExt;
35
use crate::content::linkto;
46
use crate::errors::{Error, IoErrorExt, Result};
57
use crate::{index, WriteOpts};
@@ -11,11 +13,6 @@ use std::pin::Pin;
1113
#[cfg(any(feature = "async-std", feature = "tokio"))]
1214
use std::task::{Context as TaskContext, Poll};
1315

14-
#[cfg(feature = "async-std")]
15-
use futures::io::AsyncReadExt;
16-
#[cfg(feature = "tokio")]
17-
use tokio::io::AsyncReadExt;
18-
1916
const BUF_SIZE: usize = 16 * 1024;
2017
const PROBE_SIZE: usize = 8;
2118

0 commit comments

Comments
 (0)