pub struct SettingsBuilder { /* private fields */ }Expand description
Builder for constructing Settings with a fluent API.
§Examples
use postgresql_embedded::SettingsBuilder;
let settings = SettingsBuilder::new()
.host("127.0.0.1")
.port(5433)
.username("admin")
.password("secret")
.temporary(false)
.build();To configure a Unix socket:
use postgresql_embedded::SettingsBuilder;
use std::path::PathBuf;
let settings = SettingsBuilder::new()
.socket_dir(PathBuf::from("/tmp/pg_socket"))
.build();Implementations§
Source§impl SettingsBuilder
impl SettingsBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new SettingsBuilder starting from the default Settings.
Sourcepub fn releases_url<S: Into<String>>(self, releases_url: S) -> Self
pub fn releases_url<S: Into<String>>(self, releases_url: S) -> Self
Set the releases URL for downloading PostgreSQL archives.
Sourcepub fn version(self, version: VersionReq) -> Self
pub fn version(self, version: VersionReq) -> Self
Set the PostgreSQL version requirement.
Sourcepub fn installation_dir<P: Into<PathBuf>>(self, dir: P) -> Self
pub fn installation_dir<P: Into<PathBuf>>(self, dir: P) -> Self
Set the installation directory.
Sourcepub fn password_file<P: Into<PathBuf>>(self, path: P) -> Self
pub fn password_file<P: Into<PathBuf>>(self, path: P) -> Self
Set the password file path.
Sourcepub fn temporary(self, temporary: bool) -> Self
pub fn temporary(self, temporary: bool) -> Self
Set whether the database is temporary (cleaned up on drop).
Sourcepub fn configuration(self, configuration: HashMap<String, String>) -> Self
pub fn configuration(self, configuration: HashMap<String, String>) -> Self
Set server configuration options.
Sourcepub fn config<K: Into<String>, V: Into<String>>(self, key: K, value: V) -> Self
pub fn config<K: Into<String>, V: Into<String>>(self, key: K, value: V) -> Self
Add a single server configuration option.
Sourcepub fn trust_installation_dir(self, trust: bool) -> Self
pub fn trust_installation_dir(self, trust: bool) -> Self
Set whether to trust the installation directory as-is.
Sourcepub fn socket_dir<P: Into<PathBuf>>(self, dir: P) -> Self
pub fn socket_dir<P: Into<PathBuf>>(self, dir: P) -> Self
Set the Unix socket directory. When set, the server will listen on a Unix socket in this directory. This is only supported on Unix platforms.
Trait Implementations§
Source§impl Clone for SettingsBuilder
impl Clone for SettingsBuilder
Source§fn clone(&self) -> SettingsBuilder
fn clone(&self) -> SettingsBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SettingsBuilder
impl Debug for SettingsBuilder
Auto Trait Implementations§
impl Freeze for SettingsBuilder
impl RefUnwindSafe for SettingsBuilder
impl Send for SettingsBuilder
impl Sync for SettingsBuilder
impl Unpin for SettingsBuilder
impl UnsafeUnpin for SettingsBuilder
impl UnwindSafe for SettingsBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more