pub struct Hosts(/* private fields */);Expand description
Mapped host configs by their hostname.
Implementations§
source§impl Hosts
impl Hosts
sourcepub fn load_from<P>(path: P) -> Result<Self, Error>
pub fn load_from<P>(path: P) -> Result<Self, Error>
Loads all host configs from the specified path.
sourcepub fn set(&mut self, hostname: impl Into<String>, host: Host) -> Option<Host>
pub fn set(&mut self, hostname: impl Into<String>, host: Host) -> Option<Host>
Sets a host config and returns the current value.
If no values present currently, returns None .
sourcepub fn retrieve_token(&self, hostname: &str) -> Result<Option<String>, Error>
pub fn retrieve_token(&self, hostname: &str) -> Result<Option<String>, Error>
Retrieves a token from the environment variables, the hosts file, or the secure storage. User interaction may be required to unlock the keychain, depending on the OS. If any token found for the hostname, returns None.
sourcepub fn retrieve_token_secure(
&self,
hostname: &str
) -> Result<Option<String>, Error>
👎Deprecated since 0.4.0: Use retrieve_token_secure without Hosts struct instead.
pub fn retrieve_token_secure( &self, hostname: &str ) -> Result<Option<String>, Error>
retrieve_token_secure without Hosts struct instead.Retrieves a token from the secure storage only. User interaction may be required to unlock the keychain, depending on the OS. If any token found for the hostname, returns None.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Hosts
impl<'de> Deserialize<'de> for Hosts
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Hosts
impl RefUnwindSafe for Hosts
impl Send for Hosts
impl Sync for Hosts
impl Unpin for Hosts
impl UnwindSafe for Hosts
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