subxt_utils_fetchmetadata/
lib.rs1mod error;
8
9#[cfg(feature = "url")]
10mod url;
11#[cfg(feature = "url")]
12pub use url::{MetadataVersion, Url, from_url, from_url_blocking};
13
14pub use error::Error;
15
16pub fn from_file_blocking(path: &std::path::Path) -> Result<Vec<u8>, error::Error> {
18 use std::io::Read;
19
20 let to_err = |err| error::Error::Io(path.to_string_lossy().into(), err);
21 let mut file = std::fs::File::open(path).map_err(to_err)?;
22 let mut bytes = Vec::new();
23 file.read_to_end(&mut bytes).map_err(to_err)?;
24 Ok(bytes)
25}