pub struct Config {Show 26 fields
pub version: String,
pub origin: String,
pub head: String,
pub last_commit: String,
pub branch: String,
pub core_tap_json: String,
pub core_cask_tap_json: String,
pub prefix: String,
pub api_domain: String,
pub bottle_domain: String,
pub brew_git_remote: String,
pub cask_opts: Vec<String>,
pub core_git_remote: String,
pub editor: String,
pub make_jobs: u32,
pub pip_index_url: String,
pub sorbet_runtime: String,
pub ruby: String,
pub cpu: String,
pub clang: String,
pub git: String,
pub curl: String,
pub macos: String,
pub clt: String,
pub xcode: String,
pub rosetta2: bool,
}
Expand description
Config
的结构体
Fields§
§version: String
§origin: String
§head: String
§last_commit: String
§branch: String
§core_tap_json: String
§core_cask_tap_json: String
§prefix: String
§api_domain: String
§bottle_domain: String
§brew_git_remote: String
§cask_opts: Vec<String>
§core_git_remote: String
§editor: String
§make_jobs: u32
§pip_index_url: String
§sorbet_runtime: String
§ruby: String
§cpu: String
§clang: String
§git: String
§curl: String
§macos: String
§clt: String
§xcode: String
§rosetta2: bool
Implementations§
Source§impl Config
TODO: add display fn
impl Config
TODO: add display fn
Sourcepub fn from(text: &str) -> Result<Self>
pub fn from(text: &str) -> Result<Self>
Examples
use homebrew;
let text = r#"
HOMEBREW_VERSION: 4.4.15-56-g6aac197
ORIGIN: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
HEAD: 6aac197d556f60e82490dcb46fcbe7090c8934e9
Last commit: 2 days ago
Branch: master
Core tap JSON: 10 Jan 14:49 UTC
Core cask tap JSON: 10 Jan 14:49 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_API_DOMAIN: https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api
HOMEBREW_BOTTLE_DOMAIN: https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
HOMEBREW_BREW_GIT_REMOTE: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
HOMEBREW_CASK_OPTS: []
HOMEBREW_CORE_GIT_REMOTE: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
HOMEBREW_EDITOR: nvim
HOMEBREW_MAKE_JOBS: 12
HOMEBREW_PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.3.6 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.6/bin/ruby
CPU: dodeca-core 64-bit arm_brava
Clang: 16.0.0 build 1600
Git: 2.47.1 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.1-arm64
CLT: 16.2.0.0.1.1733547573
Xcode: N/A
Rosetta 2: false
"#;
let config = homebrew::Config::from(text).unwrap();
assert_eq!(config.version, "4.4.15-56-g6aac197");
assert_eq!(config.origin, "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git");
assert_eq!(config.last_commit, "2 days ago");
assert_eq!(config.head, "6aac197d556f60e82490dcb46fcbe7090c8934e9");
assert_eq!(config.branch, "master");
assert_eq!(config.core_tap_json, "10 Jan 14:49 UTC");
assert_eq!(config.core_cask_tap_json, "10 Jan 14:49 UTC");
assert_eq!(config.prefix, "/opt/homebrew");
assert_eq!(config.api_domain, "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api");
assert_eq!(config.bottle_domain, "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles");
assert_eq!(config.brew_git_remote, "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git");
assert_eq!(config.cask_opts, Vec::<String>::new());
assert_eq!(config.core_git_remote, "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git");
assert_eq!(config.editor, "nvim");
assert_eq!(config.make_jobs, 12);
assert_eq!(config.pip_index_url, "https://pypi.tuna.tsinghua.edu.cn/simple");
assert_eq!(config.sorbet_runtime, "set");
assert_eq!(config.ruby, "3.3.6 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.6/bin/ruby");
assert_eq!(config.cpu, "dodeca-core 64-bit arm_brava");
assert_eq!(config.clang, "16.0.0 build 1600");
assert_eq!(config.git, "2.47.1 => /opt/homebrew/bin/git");
assert_eq!(config.curl, "8.7.1 => /usr/bin/curl");
assert_eq!(config.macos, "15.1-arm64");
assert_eq!(config.clt, "16.2.0.0.1.1733547573");
assert_eq!(config.xcode, "N/A");
assert_eq!(config.rosetta2, false);
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
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 Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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