Skip to content

Commit 3387610

Browse files
committed
Run tests
1 parent 59a1f70 commit 3387610

File tree

3 files changed

+0
-270
lines changed

3 files changed

+0
-270
lines changed

packages/renderers-rust/e2e/dummy/src/generated/shared.rs

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -5,96 +5,6 @@
55
//! <https://github.com/codama-idl/codama>
66
//!
77
8-
use std::fmt::Debug;
9-
use std::io::Write;
10-
use std::ops::{Deref, DerefMut};
11-
12-
use borsh::maybestd::io::Read;
13-
use borsh::{BorshDeserialize, BorshSerialize};
14-
15-
/// A vector that deserializes from a stream of bytes.
16-
///
17-
/// This is useful for deserializing a vector that does not have
18-
/// a length prefix. In order to determine how many elements to deserialize,
19-
/// the type of the elements must implement the trait `Sized`.
20-
pub struct RemainderVec<T: BorshSerialize + BorshDeserialize>(Vec<T>);
21-
22-
/// Deferences the inner `Vec` type.
23-
impl<T> Deref for RemainderVec<T>
24-
where
25-
T: BorshSerialize + BorshDeserialize,
26-
{
27-
type Target = Vec<T>;
28-
29-
fn deref(&self) -> &Self::Target {
30-
&self.0
31-
}
32-
}
33-
34-
/// Deferences the inner `Vec` type as mutable.
35-
impl<T> DerefMut for RemainderVec<T>
36-
where
37-
T: BorshSerialize + BorshDeserialize,
38-
{
39-
fn deref_mut(&mut self) -> &mut Self::Target {
40-
&mut self.0
41-
}
42-
}
43-
44-
/// `Debug` implementation for `RemainderVec`.
45-
///
46-
/// This implementation simply forwards to the inner `Vec` type.
47-
impl<T> Debug for RemainderVec<T>
48-
where
49-
T: BorshSerialize + BorshDeserialize + Debug,
50-
{
51-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
52-
f.write_fmt(format_args!("{:?}", self.0))
53-
}
54-
}
55-
56-
impl<T> BorshDeserialize for RemainderVec<T>
57-
where
58-
T: BorshSerialize + BorshDeserialize,
59-
{
60-
fn deserialize_reader<R: Read>(reader: &mut R) -> borsh::maybestd::io::Result<Self> {
61-
let length = std::mem::size_of::<T>();
62-
// buffer to read the data
63-
let mut buffer = vec![0u8; length];
64-
// vec to store the items
65-
let mut items: Vec<T> = Vec::new();
66-
67-
loop {
68-
match reader.read(&mut buffer)? {
69-
0 => break,
70-
n if n == length => items.push(T::deserialize(&mut buffer.as_slice())?),
71-
e => {
72-
return Err(borsh::maybestd::io::Error::new(
73-
borsh::maybestd::io::ErrorKind::InvalidData,
74-
format!("unexpected number of bytes (read {e}, expected {length})"),
75-
))
76-
}
77-
}
78-
}
79-
80-
Ok(Self(items))
81-
}
82-
}
83-
84-
impl<T> BorshSerialize for RemainderVec<T>
85-
where
86-
T: BorshSerialize + BorshDeserialize,
87-
{
88-
fn serialize<W: Write>(&self, writer: &mut W) -> borsh::maybestd::io::Result<()> {
89-
// serialize each item without adding a prefix for the length
90-
for item in self.0.iter() {
91-
item.serialize(writer)?;
92-
}
93-
94-
Ok(())
95-
}
96-
}
97-
988

999

10010

packages/renderers-rust/e2e/memo/src/generated/shared.rs

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -5,96 +5,6 @@
55
//! <https://github.com/codama-idl/codama>
66
//!
77
8-
use std::fmt::Debug;
9-
use std::io::Write;
10-
use std::ops::{Deref, DerefMut};
11-
12-
use borsh::maybestd::io::Read;
13-
use borsh::{BorshDeserialize, BorshSerialize};
14-
15-
/// A vector that deserializes from a stream of bytes.
16-
///
17-
/// This is useful for deserializing a vector that does not have
18-
/// a length prefix. In order to determine how many elements to deserialize,
19-
/// the type of the elements must implement the trait `Sized`.
20-
pub struct RemainderVec<T: BorshSerialize + BorshDeserialize>(Vec<T>);
21-
22-
/// Deferences the inner `Vec` type.
23-
impl<T> Deref for RemainderVec<T>
24-
where
25-
T: BorshSerialize + BorshDeserialize,
26-
{
27-
type Target = Vec<T>;
28-
29-
fn deref(&self) -> &Self::Target {
30-
&self.0
31-
}
32-
}
33-
34-
/// Deferences the inner `Vec` type as mutable.
35-
impl<T> DerefMut for RemainderVec<T>
36-
where
37-
T: BorshSerialize + BorshDeserialize,
38-
{
39-
fn deref_mut(&mut self) -> &mut Self::Target {
40-
&mut self.0
41-
}
42-
}
43-
44-
/// `Debug` implementation for `RemainderVec`.
45-
///
46-
/// This implementation simply forwards to the inner `Vec` type.
47-
impl<T> Debug for RemainderVec<T>
48-
where
49-
T: BorshSerialize + BorshDeserialize + Debug,
50-
{
51-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
52-
f.write_fmt(format_args!("{:?}", self.0))
53-
}
54-
}
55-
56-
impl<T> BorshDeserialize for RemainderVec<T>
57-
where
58-
T: BorshSerialize + BorshDeserialize,
59-
{
60-
fn deserialize_reader<R: Read>(reader: &mut R) -> borsh::maybestd::io::Result<Self> {
61-
let length = std::mem::size_of::<T>();
62-
// buffer to read the data
63-
let mut buffer = vec![0u8; length];
64-
// vec to store the items
65-
let mut items: Vec<T> = Vec::new();
66-
67-
loop {
68-
match reader.read(&mut buffer)? {
69-
0 => break,
70-
n if n == length => items.push(T::deserialize(&mut buffer.as_slice())?),
71-
e => {
72-
return Err(borsh::maybestd::io::Error::new(
73-
borsh::maybestd::io::ErrorKind::InvalidData,
74-
format!("unexpected number of bytes (read {e}, expected {length})"),
75-
))
76-
}
77-
}
78-
}
79-
80-
Ok(Self(items))
81-
}
82-
}
83-
84-
impl<T> BorshSerialize for RemainderVec<T>
85-
where
86-
T: BorshSerialize + BorshDeserialize,
87-
{
88-
fn serialize<W: Write>(&self, writer: &mut W) -> borsh::maybestd::io::Result<()> {
89-
// serialize each item without adding a prefix for the length
90-
for item in self.0.iter() {
91-
item.serialize(writer)?;
92-
}
93-
94-
Ok(())
95-
}
96-
}
97-
988

999

10010

packages/renderers-rust/e2e/system/src/generated/shared.rs

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -5,96 +5,6 @@
55
//! <https://github.com/codama-idl/codama>
66
//!
77
8-
use std::fmt::Debug;
9-
use std::io::Write;
10-
use std::ops::{Deref, DerefMut};
11-
12-
use borsh::maybestd::io::Read;
13-
use borsh::{BorshDeserialize, BorshSerialize};
14-
15-
/// A vector that deserializes from a stream of bytes.
16-
///
17-
/// This is useful for deserializing a vector that does not have
18-
/// a length prefix. In order to determine how many elements to deserialize,
19-
/// the type of the elements must implement the trait `Sized`.
20-
pub struct RemainderVec<T: BorshSerialize + BorshDeserialize>(Vec<T>);
21-
22-
/// Deferences the inner `Vec` type.
23-
impl<T> Deref for RemainderVec<T>
24-
where
25-
T: BorshSerialize + BorshDeserialize,
26-
{
27-
type Target = Vec<T>;
28-
29-
fn deref(&self) -> &Self::Target {
30-
&self.0
31-
}
32-
}
33-
34-
/// Deferences the inner `Vec` type as mutable.
35-
impl<T> DerefMut for RemainderVec<T>
36-
where
37-
T: BorshSerialize + BorshDeserialize,
38-
{
39-
fn deref_mut(&mut self) -> &mut Self::Target {
40-
&mut self.0
41-
}
42-
}
43-
44-
/// `Debug` implementation for `RemainderVec`.
45-
///
46-
/// This implementation simply forwards to the inner `Vec` type.
47-
impl<T> Debug for RemainderVec<T>
48-
where
49-
T: BorshSerialize + BorshDeserialize + Debug,
50-
{
51-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
52-
f.write_fmt(format_args!("{:?}", self.0))
53-
}
54-
}
55-
56-
impl<T> BorshDeserialize for RemainderVec<T>
57-
where
58-
T: BorshSerialize + BorshDeserialize,
59-
{
60-
fn deserialize_reader<R: Read>(reader: &mut R) -> borsh::maybestd::io::Result<Self> {
61-
let length = std::mem::size_of::<T>();
62-
// buffer to read the data
63-
let mut buffer = vec![0u8; length];
64-
// vec to store the items
65-
let mut items: Vec<T> = Vec::new();
66-
67-
loop {
68-
match reader.read(&mut buffer)? {
69-
0 => break,
70-
n if n == length => items.push(T::deserialize(&mut buffer.as_slice())?),
71-
e => {
72-
return Err(borsh::maybestd::io::Error::new(
73-
borsh::maybestd::io::ErrorKind::InvalidData,
74-
format!("unexpected number of bytes (read {e}, expected {length})"),
75-
))
76-
}
77-
}
78-
}
79-
80-
Ok(Self(items))
81-
}
82-
}
83-
84-
impl<T> BorshSerialize for RemainderVec<T>
85-
where
86-
T: BorshSerialize + BorshDeserialize,
87-
{
88-
fn serialize<W: Write>(&self, writer: &mut W) -> borsh::maybestd::io::Result<()> {
89-
// serialize each item without adding a prefix for the length
90-
for item in self.0.iter() {
91-
item.serialize(writer)?;
92-
}
93-
94-
Ok(())
95-
}
96-
}
97-
988
#[cfg(feature = "fetch")]
999
#[derive(Debug, Clone)]
10010
pub struct DecodedAccount<T> {

0 commit comments

Comments
 (0)