Merge pull request #293 from qu1x/fix-no-default-features
Fix build with `--no-default-features`.
This commit is contained in:
commit
d00ad632a1
1 changed files with 16 additions and 4 deletions
20
src/write.rs
20
src/write.rs
|
@ -11,7 +11,6 @@ use std::default::Default;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ops::RangeInclusive;
|
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
feature = "deflate",
|
feature = "deflate",
|
||||||
|
@ -977,19 +976,32 @@ impl<W: Write + io::Seek> GenericZipWriter<W> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn deflate_compression_level_range() -> RangeInclusive<i32> {
|
#[cfg(any(
|
||||||
|
feature = "deflate",
|
||||||
|
feature = "deflate-miniz",
|
||||||
|
feature = "deflate-zlib"
|
||||||
|
))]
|
||||||
|
fn deflate_compression_level_range() -> std::ops::RangeInclusive<i32> {
|
||||||
let min = flate2::Compression::none().level() as i32;
|
let min = flate2::Compression::none().level() as i32;
|
||||||
let max = flate2::Compression::best().level() as i32;
|
let max = flate2::Compression::best().level() as i32;
|
||||||
min..=max
|
min..=max
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bzip2_compression_level_range() -> RangeInclusive<i32> {
|
#[cfg(feature = "bzip2")]
|
||||||
|
fn bzip2_compression_level_range() -> std::ops::RangeInclusive<i32> {
|
||||||
let min = bzip2::Compression::none().level() as i32;
|
let min = bzip2::Compression::none().level() as i32;
|
||||||
let max = bzip2::Compression::best().level() as i32;
|
let max = bzip2::Compression::best().level() as i32;
|
||||||
min..=max
|
min..=max
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clamp_opt<T: Ord + Copy>(value: T, range: RangeInclusive<T>) -> Option<T> {
|
#[cfg(any(
|
||||||
|
feature = "deflate",
|
||||||
|
feature = "deflate-miniz",
|
||||||
|
feature = "deflate-zlib",
|
||||||
|
feature = "bzip2",
|
||||||
|
feature = "zstd"
|
||||||
|
))]
|
||||||
|
fn clamp_opt<T: Ord + Copy>(value: T, range: std::ops::RangeInclusive<T>) -> Option<T> {
|
||||||
if range.contains(&value) {
|
if range.contains(&value) {
|
||||||
Some(value)
|
Some(value)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue