Skip to content

Commit 96f1743

Browse files
committed
feat: adding Sync + Send requirements fro the Viewable
1 parent 36419d4 commit 96f1743

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

raw_struct/src/memory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ use crate::error::{
1212
Error,
1313
};
1414

15-
pub trait MemoryView {
15+
pub trait MemoryView: Send + Sync {
1616
fn read_memory(&self, offset: u64, buffer: &mut [u8]) -> Result<(), Error>;
1717
}
1818

19-
impl<T: Copy> MemoryView for T {
19+
impl<T: Copy + Send + Sync> MemoryView for T {
2020
fn read_memory(&self, offset: u64, buffer: &mut [u8]) -> Result<(), Error> {
2121
let src_buffer = unsafe {
2222
core::slice::from_raw_parts(self as *const _ as *const u8, core::mem::size_of_val(self))

raw_struct/src/view.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use alloc::borrow::Cow;
22

33
use crate::memory::MemoryView;
44

5-
pub trait ViewableBase {
5+
pub trait ViewableBase: Send + Sync {
66
fn object_memory(&self) -> &dyn MemoryView;
77
}
88

@@ -12,7 +12,7 @@ pub trait ViewableImplementation<M: MemoryView, T: ?Sized>: ViewableBase {
1212
}
1313

1414
pub trait Viewable<T: ?Sized>: 'static {
15-
type Memory: Copy;
15+
type Memory: Copy + Send + Sync;
1616
type Implementation<M: MemoryView + 'static>: ViewableImplementation<M, T>;
1717

1818
const MEMORY_SIZE: usize = core::mem::size_of::<Self::Memory>();

0 commit comments

Comments
 (0)