mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Expose std_shims::io on core
The `io::Write` trait is somewhat worthless, being implemented for nothing, yet `Read` remains fully functional. This also allows using its polyfills _without_ requiring `alloc`. Opportunity taken to make `schnorr-signatures` not require `alloc`. This will require a version bump before being published due to newly requiring the `alloc` feature be specified to maintain pre-existing behavior. Enables resolving https://github.com/monero-oxide/monero-oxide/issues/48.
This commit is contained in:
@@ -17,7 +17,7 @@ rustdoc-args = ["--cfg", "docsrs"]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
std-shims = { path = "../../common/std-shims", version = "0.1.4", default-features = false, optional = true }
|
||||
std-shims = { path = "../../common/std-shims", version = "0.1.4", default-features = false }
|
||||
|
||||
zeroize = { version = "^1.5", default-features = false, features = ["derive"] }
|
||||
subtle = { version = "^2.4", default-features = false }
|
||||
@@ -33,7 +33,7 @@ hex = { version = "0.4", default-features = false, features = ["std"] }
|
||||
ff-group-tests = { version = "0.13", path = "../ff-group-tests" }
|
||||
|
||||
[features]
|
||||
alloc = ["std-shims", "zeroize/alloc", "digest/alloc", "ff/alloc"]
|
||||
alloc = ["zeroize/alloc", "digest/alloc", "ff/alloc"]
|
||||
std = [
|
||||
"alloc",
|
||||
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use core::fmt::Debug;
|
||||
#[cfg(feature = "alloc")]
|
||||
#[allow(unused_imports)]
|
||||
use std_shims::prelude::*;
|
||||
#[cfg(feature = "alloc")]
|
||||
use std_shims::io::{self, Read};
|
||||
|
||||
use subtle::{CtOption, ConstantTimeEq, ConditionallySelectable};
|
||||
@@ -112,7 +110,6 @@ pub trait GroupCanonicalEncoding: WrappedGroup {
|
||||
}
|
||||
|
||||
/// `std::io` extensions for `GroupCanonicalEncoding.`
|
||||
#[cfg(feature = "alloc")]
|
||||
#[allow(non_snake_case)]
|
||||
pub trait GroupIo: GroupCanonicalEncoding {
|
||||
/// Read a canonical field element from something implementing `std::io::Read`.
|
||||
@@ -129,8 +126,6 @@ pub trait GroupIo: GroupCanonicalEncoding {
|
||||
}
|
||||
|
||||
/// Read a canonical point from something implementing `std::io::Read`.
|
||||
#[cfg(feature = "alloc")]
|
||||
#[allow(non_snake_case)]
|
||||
fn read_G<R: Read>(reader: &mut R) -> io::Result<Self::G> {
|
||||
let mut bytes = <Self::G as GroupEncoding>::Repr::default();
|
||||
reader.read_exact(bytes.as_mut())?;
|
||||
|
||||
Reference in New Issue
Block a user