Skip to content

Commit 77cadf4

Browse files
Merge pull request #31 from theseus-rs/disable-default-bundled-feature
fix!: remove bundled as a default feature and corrected bug when the bundled feature is not used
2 parents 3c841ce + 83166d7 commit 77cadf4

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

Cargo.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

postgresql_embedded/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ test-log = { workspace = true }
3333
tokio = { workspace = true }
3434

3535
[features]
36-
default = ["bundled"]
36+
default = []
3737
blocking = ["tokio"]
3838
bundled = []
3939
tokio = ["dep:tokio"]

postgresql_embedded/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ At runtime, the PostgreSQL binaries are cached by default in the following direc
7171

7272
## Feature flags
7373

74-
postgresql_embedded uses [feature flags] to address compile time and binary size
74+
postgresql_embedded uses feature flags to address compile time and binary size
7575
uses.
7676

7777
The following features are available:
7878

7979
| Name | Description | Default? |
8080
|------------|-----------------------------------------------------------|----------|
81-
| `bundled` | Bundles the PostgreSQL archive into the resulting binary | Yes |
81+
| `bundled` | Bundles the PostgreSQL archive into the resulting binary | No |
8282
| `blocking` | Enables the blocking API; requires `tokio` | No |
8383
| `tokio` | Enables using tokio for async | No |
8484

postgresql_embedded/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@
7676
//!
7777
//! ## Feature flags
7878
//!
79-
//! postgresql_embedded uses [feature flags] to address compile time and binary size
79+
//! postgresql_embedded uses feature flags to address compile time and binary size
8080
//! uses.
8181
//!
8282
//! The following features are available:
8383
//!
8484
//! | Name | Description | Default? |
8585
//! |------------|-----------------------------------------------------------|----------|
86-
//! | `bundled` | Bundles the PostgreSQL archive into the resulting binary | Yes |
86+
//! | `bundled` | Bundles the PostgreSQL archive into the resulting binary | No |
8787
//! | `blocking` | Enables the blocking API; requires `tokio` | No |
8888
//! | `tokio` | Enables using tokio for async | No |
8989
//!

postgresql_embedded/src/postgresql.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use crate::command::traits::{CommandBuilder, CommandExecutor};
66
use crate::error::Error::{DatabaseInitializationError, DatabaseStartError, DatabaseStopError};
77
use crate::error::Result;
88
use crate::settings::Settings;
9-
use bytes::Bytes;
109
use postgresql_archive::{extract, get_archive};
1110
use postgresql_archive::{get_version, Version};
1211
use std::fs::{create_dir_all, remove_dir_all, remove_file};
@@ -79,9 +78,13 @@ impl PostgreSQL {
7978

8079
/// Get the default version used if not otherwise specified
8180
pub fn default_version() -> Version {
82-
if cfg!(feature = "bundled") {
81+
#[cfg(feature = "bundled")]
82+
{
8383
*ARCHIVE_VERSION
84-
} else {
84+
}
85+
86+
#[cfg(not(feature = "bundled"))]
87+
{
8588
postgresql_archive::LATEST
8689
}
8790
}
@@ -176,7 +179,7 @@ impl PostgreSQL {
176179
// restricted or undesirable.
177180
let (version, bytes) = if ARCHIVE_VERSION.deref() == &self.version {
178181
debug!("Using bundled installation archive");
179-
(self.version, Bytes::copy_from_slice(ARCHIVE))
182+
(self.version, bytes::Bytes::copy_from_slice(ARCHIVE))
180183
} else {
181184
get_archive(&self.version).await?
182185
};
@@ -445,8 +448,6 @@ impl Drop for PostgreSQL {
445448

446449
#[cfg(test)]
447450
mod tests {
448-
use test_log::test;
449-
450451
#[test]
451452
#[cfg(feature = "bundled")]
452453
fn test_archive_version() {

0 commit comments

Comments
 (0)