pub struct NodeJSRelInfo {
pub os: NodeJSOS,
pub arch: NodeJSArch,
pub ext: NodeJSPkgExt,
pub version: String,
pub filename: String,
pub sha256: String,
pub url: String,
/* private fields */
}Fields§
§os: NodeJSOSThe operating system for the Node.js distributable you are targeting
arch: NodeJSArchThe CPU architecture for the Node.js distributable you are targeting
ext: NodeJSPkgExtThe file extension for the Node.js distributable you are targeting
version: StringThe version of Node.js you are targeting as a semver string
filename: StringThe filename of the Node.js distributable (populated after fetching)
sha256: StringThe hash for the Node.js distributable (populated after fetching)
url: StringThe fully qualified url for the Node.js distributable (populated after fetching)
Implementations§
Source§impl NodeJSRelInfo
impl NodeJSRelInfo
Sourcepub fn from_env<T: AsRef<str>>(
semver: T,
) -> Result<NodeJSRelInfo, NodeJSRelInfoError>
pub fn from_env<T: AsRef<str>>( semver: T, ) -> Result<NodeJSRelInfo, NodeJSRelInfoError>
Sourcepub fn macos(&mut self) -> &mut Self
pub fn macos(&mut self) -> &mut Self
Sets instance os field to darwin
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").macos();Sourcepub fn linux(&mut self) -> &mut Self
pub fn linux(&mut self) -> &mut Self
Sets instance os field to linux
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").linux();Sourcepub fn windows(&mut self) -> &mut Self
pub fn windows(&mut self) -> &mut Self
Sets instance os field to windows
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").windows();Sourcepub fn aix(&mut self) -> &mut Self
pub fn aix(&mut self) -> &mut Self
Sets instance os field to aix
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").aix();Sourcepub fn x64(&mut self) -> &mut Self
pub fn x64(&mut self) -> &mut Self
Sets instance arch field to x64
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").x64();Sourcepub fn x86(&mut self) -> &mut Self
pub fn x86(&mut self) -> &mut Self
Sets instance arch field to x86
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").x86();Sourcepub fn arm64(&mut self) -> &mut Self
pub fn arm64(&mut self) -> &mut Self
Sets instance arch field to arm64
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").arm64();Sourcepub fn armv7l(&mut self) -> &mut Self
pub fn armv7l(&mut self) -> &mut Self
Sets instance arch field to armv7l
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").armv7l();Sourcepub fn ppc64(&mut self) -> &mut Self
pub fn ppc64(&mut self) -> &mut Self
Sets instance arch field to ppc64
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").ppc64();Sourcepub fn ppc64le(&mut self) -> &mut Self
pub fn ppc64le(&mut self) -> &mut Self
Sets instance arch field to ppc64le
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").ppc64le();Sourcepub fn s390x(&mut self) -> &mut Self
pub fn s390x(&mut self) -> &mut Self
Sets instance arch field to s390x
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").s390x();Sourcepub fn tar_gz(&mut self) -> &mut Self
pub fn tar_gz(&mut self) -> &mut Self
Sets instance ext field to tar.gz
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").tar_gz();Sourcepub fn tar_xz(&mut self) -> &mut Self
pub fn tar_xz(&mut self) -> &mut Self
Sets instance ext field to tar.xz
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").tar_xz();Sourcepub fn zip(&mut self) -> &mut Self
pub fn zip(&mut self) -> &mut Self
Sets instance ext field to zip
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").zip();Sourcepub fn s7z(&mut self) -> &mut Self
pub fn s7z(&mut self) -> &mut Self
Sets instance ext field to 7z
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").s7z();Sourcepub fn msi(&mut self) -> &mut Self
pub fn msi(&mut self) -> &mut Self
Sets instance ext field to msi
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").msi();Sourcepub fn to_owned(&self) -> Self
pub fn to_owned(&self) -> Self
Creates owned data from reference for convenience when chaining
§Examples
use node_js_release_info::NodeJSRelInfo;
let info = NodeJSRelInfo::new("20.6.1").windows().x64().zip().to_owned();Sourcepub async fn fetch(&mut self) -> Result<Self, NodeJSRelInfoError>
pub async fn fetch(&mut self) -> Result<Self, NodeJSRelInfoError>
Fetches Node.js metadata for specified configuration from the releases download server
§Examples
use node_js_release_info::{NodeJSRelInfo, NodeJSRelInfoError};
#[tokio::main]
async fn main() -> Result<(), NodeJSRelInfoError> {
let info = NodeJSRelInfo::new("20.6.1").macos().arm64().fetch().await?;
assert_eq!(info.version, "20.6.1");
assert_eq!(info.filename, "node-v20.6.1-darwin-arm64.tar.gz");
assert_eq!(info.sha256, "d8ba8018d45b294429b1a7646ccbeaeb2af3cdf45b5c91dabbd93e2a2035cb46");
assert_eq!(info.url, "https://nodejs.org/download/release/v20.6.1/node-v20.6.1-darwin-arm64.tar.gz");
Ok(())
}Sourcepub async fn fetch_all(&self) -> Result<Vec<NodeJSRelInfo>, NodeJSRelInfoError>
pub async fn fetch_all(&self) -> Result<Vec<NodeJSRelInfo>, NodeJSRelInfoError>
Fetches Node.js metadata for all supported configurations from the releases download server
§Examples
use node_js_release_info::{NodeJSRelInfo, NodeJSRelInfoError};
#[tokio::main]
async fn main() -> Result<(), NodeJSRelInfoError> {
let info = NodeJSRelInfo::new("20.6.1");
let all = info.fetch_all().await?;
assert_eq!(all.len(), 24);
assert_eq!(all[2].version, "20.6.1");
assert_eq!(all[2].filename, "node-v20.6.1-darwin-arm64.tar.gz");
assert_eq!(all[2].sha256, "d8ba8018d45b294429b1a7646ccbeaeb2af3cdf45b5c91dabbd93e2a2035cb46");
assert_eq!(all[2].url, "https://nodejs.org/download/release/v20.6.1/node-v20.6.1-darwin-arm64.tar.gz");
Ok(())
}Trait Implementations§
Source§impl Clone for NodeJSRelInfo
impl Clone for NodeJSRelInfo
Source§fn clone(&self) -> NodeJSRelInfo
fn clone(&self) -> NodeJSRelInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more