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 */
}Expand description
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(self) -> Self
pub fn macos(self) -> Self
Sets instance os field to darwin
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").macos();Sourcepub fn linux(self) -> Self
pub fn linux(self) -> Self
Sets instance os field to linux
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").linux();Sourcepub fn windows(self) -> Self
pub fn windows(self) -> Self
Sets instance os field to windows
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").windows();Sourcepub fn aix(self) -> Self
pub fn aix(self) -> Self
Sets instance os field to aix
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").aix();Sourcepub fn x64(self) -> Self
pub fn x64(self) -> Self
Sets instance arch field to x64
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").x64();Sourcepub fn x86(self) -> Self
pub fn x86(self) -> Self
Sets instance arch field to x86
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").x86();Sourcepub fn arm64(self) -> Self
pub fn arm64(self) -> Self
Sets instance arch field to arm64
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").arm64();Sourcepub fn armv7l(self) -> Self
pub fn armv7l(self) -> Self
Sets instance arch field to armv7l
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").armv7l();Sourcepub fn ppc64(self) -> Self
pub fn ppc64(self) -> Self
Sets instance arch field to ppc64
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").ppc64();Sourcepub fn ppc64le(self) -> Self
pub fn ppc64le(self) -> Self
Sets instance arch field to ppc64le
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").ppc64le();Sourcepub fn s390x(self) -> Self
pub fn s390x(self) -> Self
Sets instance arch field to s390x
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").s390x();Sourcepub fn tar_gz(self) -> Self
pub fn tar_gz(self) -> Self
Sets instance ext field to tar.gz
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").tar_gz();Sourcepub fn tar_xz(self) -> Self
pub fn tar_xz(self) -> Self
Sets instance ext field to tar.xz
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").tar_xz();Sourcepub fn zip(self) -> Self
pub fn zip(self) -> Self
Sets instance ext field to zip
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").zip();Sourcepub fn s7z(self) -> Self
pub fn s7z(self) -> Self
Sets instance ext field to 7z
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").s7z();Sourcepub fn msi(self) -> Self
pub fn msi(self) -> Self
Sets instance ext field to msi
§Examples
use node_js_release_info::NodeJsRelInfo;
let info = NodeJsRelInfo::new("24.19.0").msi();Sourcepub async fn fetch(self) -> Result<Self, NodeJsRelInfoError>
pub async fn fetch(self) -> Result<Self, NodeJsRelInfoError>
Creates owned data from reference for convenience when chaining
Fetches Node.js metadata for specified configuration from the releases download server
§Errors
Returns InvalidVersion when
version is not valid semver,
UnrecognizedVersion when
the release does not exist,
UnrecognizedConfiguration
when the release exists but ships no such os/arch/ext combination, and
HttpError when the request fails
§Examples
use node_js_release_info::{NodeJsRelInfo, NodeJsRelInfoError};
#[tokio::main]
async fn main() -> Result<(), NodeJsRelInfoError> {
let info = NodeJsRelInfo::new("24.19.0").macos().arm64().fetch().await?;
assert_eq!(info.version, "24.19.0");
assert_eq!(info.filename, "node-v24.19.0-darwin-arm64.tar.gz");
assert_eq!(info.sha256, "8294b7aa9b03997481c06babf1e8b270c859358f27da57a11509afe537ac381d");
assert_eq!(info.url, "https://nodejs.org/download/release/v24.19.0/node-v24.19.0-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("24.19.0");
let all = info.fetch_all().await?;
assert_eq!(all.len(), 19);
assert_eq!(all[2].version, "24.19.0");
assert_eq!(all[2].filename, "node-v24.19.0-darwin-arm64.tar.gz");
assert_eq!(all[2].sha256, "8294b7aa9b03997481c06babf1e8b270c859358f27da57a11509afe537ac381d");
assert_eq!(all[2].url, "https://nodejs.org/download/release/v24.19.0/node-v24.19.0-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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NodeJsRelInfo
impl Debug for NodeJsRelInfo
Source§impl Default for NodeJsRelInfo
impl Default for NodeJsRelInfo
Source§fn default() -> NodeJsRelInfo
fn default() -> NodeJsRelInfo
Source§impl<'de> Deserialize<'de> for NodeJsRelInfo
impl<'de> Deserialize<'de> for NodeJsRelInfo
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>,
impl Eq for NodeJsRelInfo
Source§impl Hash for NodeJsRelInfo
impl Hash for NodeJsRelInfo
Source§impl PartialEq for NodeJsRelInfo
impl PartialEq for NodeJsRelInfo
Source§impl Serialize for NodeJsRelInfo
impl Serialize for NodeJsRelInfo
impl StructuralPartialEq for NodeJsRelInfo
Auto Trait Implementations§
impl Freeze for NodeJsRelInfo
impl RefUnwindSafe for NodeJsRelInfo
impl Send for NodeJsRelInfo
impl Sync for NodeJsRelInfo
impl Unpin for NodeJsRelInfo
impl UnsafeUnpin for NodeJsRelInfo
impl UnwindSafe for NodeJsRelInfo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.