subxt-core compiles to no std again

This commit is contained in:
Tadeo hepperle
2024-01-30 10:18:08 +01:00
parent a3ec38f8b6
commit 4512ad7fc0
9 changed files with 18 additions and 171 deletions
-17
View File
@@ -15,7 +15,6 @@ mod wrapper_opaque;
use codec::{Compact, Decode, Encode};
use derivative::Derivative;
use url::Url;
pub use account_id::AccountId32;
use borrow::ToOwned;
@@ -50,22 +49,6 @@ pub(crate) fn strip_compact_prefix(bytes: &[u8]) -> Result<(u64, &[u8]), codec::
Ok((val.0, *cursor))
}
/// A URL is considered secure if it uses a secure scheme ("https" or "wss") or is referring to localhost.
///
/// Returns an error if the the string could not be parsed into a URL.
pub fn url_is_secure(url: &str) -> Result<bool, url::ParseError> {
let url = Url::parse(url)?;
let secure_scheme = url.scheme() == "https" || url.scheme() == "wss";
let is_localhost = url.host().is_some_and(|e| match e {
url::Host::Domain(e) => e == "localhost",
url::Host::Ipv4(e) => e.is_loopback(),
url::Host::Ipv6(e) => e.is_loopback(),
});
Ok(secure_scheme || is_localhost)
}
use crate::prelude::*;
/// A version of [`core::marker::PhantomData`] that is also Send and Sync (which is fine