Crate netrc_util

Source
Expand description

§netrc_util

A simple libary for parsing netrc files.

§Usage

use netrc_util::{Host, NetrcParser};

let netrc_content = "machine sample.test login user password pass";
let host = Host::parse("sample.test").unwrap();

let entry = NetrcParser::new(netrc_content.as_bytes())
    .entry_for_host(&host)
    .unwrap()
    .unwrap();

assert_eq!(entry.login(), Some("user".to_string()).as_ref());
assert_eq!(entry.password(), "pass");

Re-exports§

pub use crate::netrc_parser::NetrcParser;
pub use crate::netrc_parser::ValidatedEntry;
pub use crate::raw_netrc_parser::RawEntry;
pub use crate::raw_netrc_parser::RawNetrcParser;

Modules§

netrc_parser
raw_netrc_parser

Enums§

Host
The host name of an URL.