Files
pezkuwi-sdk/vendor/pezkuwi-subxt/utils/fetch-metadata/src/lib.rs
T
pezkuwichain 62674ce919 feat: Vendor pezkuwi-subxt and pezkuwi-zombienet-sdk into monorepo
- Add pezkuwi-subxt crates to vendor/pezkuwi-subxt
- Add pezkuwi-zombienet-sdk crates to vendor/pezkuwi-zombienet-sdk
- Convert git dependencies to path dependencies
- Add vendor crates to workspace members
- Remove test/example crates from vendor (not needed for SDK)
- Fix feature propagation issues detected by zepter
- Fix workspace inheritance for internal dependencies
- All 606 crates now in workspace
- All 6919 internal dependency links verified correct
- No git dependencies remaining
2025-12-23 09:37:11 +03:00

31 lines
790 B
Rust

// Copyright 2019-2024 Parity Technologies (UK) Ltd.
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
//! Subxt utils fetch metadata.
#![cfg_attr(docsrs, feature(doc_cfg))]
// Internal helper macros
#[macro_use]
mod macros;
mod error;
cfg_fetch_from_url! {
mod url;
pub use url::{from_url, from_url_blocking, MetadataVersion, Url};
}
pub use error::Error;
/// Fetch metadata from a file in a blocking manner.
pub fn from_file_blocking(path: &std::path::Path) -> Result<Vec<u8>, error::Error> {
use std::io::Read;
let to_err = |err| error::Error::Io(path.to_string_lossy().into(), err);
let mut file = std::fs::File::open(path).map_err(to_err)?;
let mut bytes = Vec::new();
file.read_to_end(&mut bytes).map_err(to_err)?;
Ok(bytes)
}