Vendor dependencies

This commit is contained in:
2026-08-01 16:11:49 +03:00
parent 7f139a0241
commit 6b5e7f0f8b
29706 changed files with 9575646 additions and 0 deletions
@@ -0,0 +1,35 @@
#![allow(unused)]
use crate::common_macro::schema_imports::*;
use core::fmt::{Debug, Display};
/// test: Sausage wasn't populated with param Sausage<W>
#[derive(borsh::BorshSchema, Debug)]
enum AWithSkip<C, W> {
Bacon,
Eggs,
Salad(u32, C, u32),
Sausage {
#[borsh(skip)]
wrapper: W,
filling: u32,
},
}
/// test: inner structs in BorshSchema derive don't need any bounds, unrelated to BorshSchema
// #[derive(borsh::BorshSchema)]
// struct SideLeft<A>(
// A,
// )
// where
// A: Display + Debug,
// B: Display + Debug;
#[derive(borsh::BorshSchema)]
enum Side<A, B>
where
A: Display + Debug,
B: Display + Debug,
{
Left(A),
Right(B),
}
@@ -0,0 +1,44 @@
use borsh::{BorshDeserialize, BorshSerialize};
#[allow(unused)]
use alloc::{string::String, vec::Vec};
#[cfg(feature = "hashbrown")]
use hashbrown::HashMap;
#[cfg(hash_collections)]
use core::{cmp::Eq, hash::Hash};
#[cfg(feature = "std")]
use std::collections::HashMap;
use alloc::collections::BTreeMap;
/// `T: Ord` bound is required for `BorshDeserialize` derive to be successful
#[allow(unused)]
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug)]
enum E<T: Ord, U, W> {
X { f: BTreeMap<T, U> },
Y(W),
}
#[cfg(hash_collections)]
#[allow(unused)]
#[derive(BorshSerialize, BorshDeserialize, Debug)]
enum I1<K, V, R> {
B {
#[allow(unused)]
#[borsh(skip)]
x: HashMap<K, V>,
y: String,
},
C(K, Vec<R>),
}
#[cfg(hash_collections)]
#[allow(unused)]
#[derive(BorshSerialize, BorshDeserialize, Debug)]
enum I2<K: Ord + Eq + Hash, R, U> {
B { x: HashMap<K, R>, y: String },
C(K, #[borsh(skip)] U),
}
@@ -0,0 +1,98 @@
#[cfg(feature = "hashbrown")]
use hashbrown::HashMap;
#[cfg(hash_collections)]
use core::{cmp::Eq, hash::Hash};
#[cfg(feature = "std")]
use std::collections::HashMap;
use alloc::{
collections::BTreeMap,
string::String,
};
use borsh::{BorshDeserialize, BorshSerialize};
#[derive(BorshSerialize, BorshDeserialize, Debug)]
struct TupleA<W>(W, u32);
#[derive(BorshSerialize, BorshDeserialize, Debug)]
struct NamedA<W> {
a: W,
b: u32,
}
/// `T: PartialOrd` is injected here via field bound to avoid having this restriction on
/// the struct itself
#[cfg(hash_collections)]
#[derive(BorshSerialize)]
struct C1<T, U> {
a: String,
#[borsh(bound(serialize = "T: borsh::ser::BorshSerialize + Ord,
U: borsh::ser::BorshSerialize"))]
b: HashMap<T, U>,
}
/// `T: PartialOrd + Hash + Eq` is injected here via field bound to avoid having this restriction on
/// the struct itself
#[allow(unused)]
#[cfg(hash_collections)]
#[derive(BorshDeserialize)]
struct C2<T, U> {
a: String,
#[borsh(bound(deserialize = "T: Ord + Hash + Eq + borsh::de::BorshDeserialize,
U: borsh::de::BorshDeserialize"))]
b: HashMap<T, U>,
}
/// `T: Ord` bound is required for `BorshDeserialize` derive to be successful
#[derive(BorshSerialize, BorshDeserialize)]
struct D<T: Ord, R> {
a: String,
b: BTreeMap<T, R>,
}
#[cfg(hash_collections)]
#[derive(BorshSerialize)]
struct G<K, V, U>(#[borsh(skip)] HashMap<K, V>, U);
#[cfg(hash_collections)]
#[derive(BorshDeserialize)]
struct G1<K, V, U>(#[borsh(skip)] HashMap<K, V>, U);
#[cfg(hash_collections)]
#[derive(BorshDeserialize)]
struct G2<K: Ord + Hash + Eq, R, U>(HashMap<K, R>, #[borsh(skip)] U);
/// implicit derived `core::default::Default` bounds on `K` and `V` are dropped by empty bound
/// specified, as `HashMap` hash its own `Default` implementation
#[cfg(hash_collections)]
#[derive(BorshDeserialize)]
struct G3<K, V, U>(#[borsh(skip, bound(deserialize = ""))] HashMap<K, V>, U);
#[cfg(hash_collections)]
#[derive(BorshSerialize, BorshDeserialize)]
struct H<K: Ord, V, U> {
x: BTreeMap<K, V>,
#[allow(unused)]
#[borsh(skip)]
y: U,
}
trait TraitName {
type Associated;
fn method(&self);
}
#[allow(unused)]
#[derive(BorshSerialize)]
struct ParametrizedWrongDerive<T, V>
where
T: TraitName,
{
#[borsh(bound(serialize = "<T as TraitName>::Associated: borsh::ser::BorshSerialize"))]
field: <T as TraitName>::Associated,
another: V,
}
@@ -0,0 +1,15 @@
// Borsh macros should not collide with the local modules:
// https://github.com/near/borsh-rs/issues/11
mod std {}
mod core {}
#[allow(unused)]
#[derive(borsh::BorshSerialize, borsh::BorshDeserialize)]
struct A;
#[allow(unused)]
#[derive(borsh::BorshSerialize, borsh::BorshDeserialize)]
enum B {
C,
D,
}
@@ -0,0 +1,38 @@
use borsh::{BorshDeserialize, BorshSerialize};
#[cfg(feature = "hashbrown")]
use hashbrown::HashMap;
#[cfg(feature = "std")]
use std::collections::HashMap;
#[cfg(hash_collections)]
use core::{cmp::Eq, hash::Hash};
use alloc::{boxed::Box, string::String};
#[cfg(hash_collections)]
#[allow(unused)]
#[derive(BorshSerialize, BorshDeserialize)]
struct CRec<U: Ord + Hash + Eq> {
a: String,
b: HashMap<U, CRec<U>>,
}
// `impl<T, U> BorshDeserialize for Box<T>` pulls in => `ToOwned`
// => pulls in at least `Clone`
#[allow(unused)]
#[derive(Clone, BorshSerialize, BorshDeserialize)]
struct CRecA {
a: String,
b: Box<CRecA>,
}
#[cfg(hash_collections)]
#[allow(unused)]
#[derive(BorshSerialize, BorshDeserialize)]
struct CRecC {
a: String,
b: HashMap<String, CRecC>,
}