Skip to main content

NetrcCredentialHelper

Struct NetrcCredentialHelper 

Source
pub struct NetrcCredentialHelper { /* private fields */ }
Expand description

Netrc-backed credential helper.

Cheap to construct: the file is read and parsed once at construction, and lookups walk the parsed list linearly (netrc files are small in practice).

Implementations§

Source§

impl NetrcCredentialHelper

Source

pub fn from_contents(content: &str) -> Self

Build from a parsed-and-already-decoded netrc body.

Source

pub fn from_default_location() -> Option<Self>

Read the user’s default netrc file.

Tries $HOME/.netrc, falling back to $HOME/_netrc on Windows when .netrc isn’t present. Returns None when no netrc file exists, when $HOME isn’t set, or when the file is unreadable; these are not user errors, just “no creds from this source”.

Source

pub fn from_path(path: &Path) -> Option<Self>

Read + parse path. Returns None when the file is missing or unreadable; logging a parse error is upstream’s choice but “no creds from this source” matches Helper-trait semantics.

Trait Implementations§

Source§

impl Debug for NetrcCredentialHelper

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Helper for NetrcCredentialHelper

Source§

fn fill(&self, query: &Query) -> Result<Option<Credentials>, HelperError>

Try to fetch credentials for query. Read more
Source§

fn approve(&self, query: &Query, creds: &Credentials) -> Result<(), HelperError>

Tell the helper that creds worked for query. Read more
Source§

fn reject(&self, query: &Query, creds: &Credentials) -> Result<(), HelperError>

Tell the helper that creds did not work for query. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.