pub struct Pgpass { /* private fields */ }Expand description
Parsed .pgpass file entries for upstream password lookup.
Implementations§
Source§impl Pgpass
impl Pgpass
Sourcepub fn load(path: &Path) -> Self
pub fn load(path: &Path) -> Self
Load and parse a .pgpass file. Returns an empty set on I/O errors
(matching PostgreSQL behavior — a missing file is not fatal).
Sourcepub fn lookup(
&self,
hostname: &str,
port: &str,
database: &str,
username: &str,
) -> Option<&str>
pub fn lookup( &self, hostname: &str, port: &str, database: &str, username: &str, ) -> Option<&str>
Look up a password for the given connection parameters. Returns the
password from the first matching entry, or None if no entry matches.
Sourcepub fn lookup_addr(
&self,
addr: &str,
database: &str,
username: &str,
) -> Option<&str>
pub fn lookup_addr( &self, addr: &str, database: &str, username: &str, ) -> Option<&str>
Look up a password by host:port address (or bracketed IPv6).
Convenience wrapper around Pgpass::lookup that handles the
host/port split so call sites don’t repeat the same three-line
dance.
Auto Trait Implementations§
impl Forget for Pgpass
impl Freeze for Pgpass
impl Move for Pgpass
impl RefUnwindSafe for Pgpass
impl Send for Pgpass
impl Sync for Pgpass
impl Unpin for Pgpass
impl UnsafeUnpin for Pgpass
impl UnwindSafe for Pgpass
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