Skip to content

Commit f20c0e6

Browse files
committed
fix!: remove bundled as a default feature and corrected bug when the bundled feature is not used
1 parent 3c841ce commit f20c0e6

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
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: 6 additions & 7 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,11 +78,11 @@ impl PostgreSQL {
7978

8079
/// Get the default version used if not otherwise specified
8180
pub fn default_version() -> Version {
82-
if cfg!(feature = "bundled") {
83-
*ARCHIVE_VERSION
84-
} else {
85-
postgresql_archive::LATEST
86-
}
81+
#[cfg(feature = "bundled")]
82+
{ *ARCHIVE_VERSION }
83+
84+
#[cfg(not(feature = "bundled"))]
85+
{ postgresql_archive::LATEST }
8786
}
8887

8988
/// Get the [status](Status) of the PostgreSQL server
@@ -176,7 +175,7 @@ impl PostgreSQL {
176175
// restricted or undesirable.
177176
let (version, bytes) = if ARCHIVE_VERSION.deref() == &self.version {
178177
debug!("Using bundled installation archive");
179-
(self.version, Bytes::copy_from_slice(ARCHIVE))
178+
(self.version, bytes::Bytes::copy_from_slice(ARCHIVE))
180179
} else {
181180
get_archive(&self.version).await?
182181
};

0 commit comments

Comments
 (0)