Skip to content

Commit bbce1cc

Browse files
authored
Merge pull request #53 from kinode-dao/dr/lazy_load_blob
add PartialEq for LazyLoadBlob, refactor into its own file
2 parents 4c49368 + 6a01217 commit bbce1cc

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/lazy_load_blob.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pub use crate::LazyLoadBlob;
2+
3+
impl std::default::Default for LazyLoadBlob {
4+
fn default() -> Self {
5+
LazyLoadBlob {
6+
mime: None,
7+
bytes: Vec::new(),
8+
}
9+
}
10+
}
11+
12+
impl std::cmp::PartialEq for LazyLoadBlob {
13+
fn eq(&self, other: &Self) -> bool {
14+
self.mime == other.mime && self.bytes == other.bytes
15+
}
16+
}

src/lib.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ mod on_exit;
6060
pub use on_exit::OnExit;
6161
mod capability;
6262
pub use capability::Capability;
63+
mod lazy_load_blob;
64+
pub use lazy_load_blob::LazyLoadBlob;
6365

6466
/// Implement the wit-bindgen specific code that the kernel uses to hook into
6567
/// a process. Write an `init(our: Address)` function and call it with this.
@@ -134,15 +136,6 @@ pub fn spawn(
134136
)
135137
}
136138

137-
impl std::default::Default for LazyLoadBlob {
138-
fn default() -> Self {
139-
LazyLoadBlob {
140-
mime: None,
141-
bytes: Vec::new(),
142-
}
143-
}
144-
}
145-
146139
/// Create a blob with no MIME type and a generic type, plus a serializer
147140
/// function that turns that type into bytes.
148141
///

0 commit comments

Comments
 (0)