Skip to content

Commit 6e2a218

Browse files
committed
Constrain Encodable by Sized
1 parent c20b453 commit 6e2a218

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

rust/bufferfish-core/src/encodable.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use crate::{Bufferfish, BufferfishError};
44

55
/// Types implementing this trait are able to be encoded to a `Bufferfish`.
6-
pub trait Encodable {
6+
pub trait Encodable: Sized {
77
/// Encode the type into a given `Bufferfish`.
88
fn encode(&self, bf: &mut Bufferfish) -> Result<(), BufferfishError>;
99

@@ -19,10 +19,7 @@ pub trait Encodable {
1919
///
2020
/// This is useful when you want to reuse an existing buffer to avoid
2121
/// allocations.
22-
fn encode_into(self, bf: &mut Bufferfish) -> Result<(), BufferfishError>
23-
where
24-
Self: Sized,
25-
{
22+
fn encode_into(self, bf: &mut Bufferfish) -> Result<(), BufferfishError> {
2623
self.encode(bf)
2724
}
2825
}

rust/bufferfish-derive/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ pub fn bufferfish_impl_encodable(input: proc_macro::TokenStream) -> proc_macro::
6969
}
7070

7171
fn encode_into(self, bf: &mut bufferfish::Bufferfish) -> Result<(), bufferfish::BufferfishError>
72-
where
73-
Self: Sized,
7472
{
7573
#packet_id_snippet
7674
self.encode(bf)

0 commit comments

Comments
 (0)