rename the pointer read/write methods to read and write
these names were artifacts of some early confusion / bad design i made in the traits. read and write are much simpler names! also, change a ptr_mut to ptr where we just read the contents in the argument marshalling for structs. this has no effect, but it is more correct.
This commit is contained in:
@@ -225,19 +225,19 @@ mod test {
|
||||
}
|
||||
{
|
||||
let ptr = guest_memory.ptr_mut(12).expect("ptr mut to first el");
|
||||
ptr.write_ptr_to_guest(
|
||||
ptr.write(
|
||||
&guest_memory
|
||||
.ptr::<GuestPtr<u8>>(0)
|
||||
.expect("ptr to the first value"),
|
||||
);
|
||||
let ptr = guest_memory.ptr_mut(16).expect("ptr mut to first el");
|
||||
ptr.write_ptr_to_guest(
|
||||
ptr.write(
|
||||
&guest_memory
|
||||
.ptr::<GuestPtr<u8>>(4)
|
||||
.expect("ptr to the second value"),
|
||||
);
|
||||
let ptr = guest_memory.ptr_mut(20).expect("ptr mut to first el");
|
||||
ptr.write_ptr_to_guest(
|
||||
ptr.write(
|
||||
&guest_memory
|
||||
.ptr::<GuestPtr<u8>>(8)
|
||||
.expect("ptr to the third value"),
|
||||
|
||||
@@ -80,7 +80,7 @@ impl<'a, T> GuestPtr<'a, T>
|
||||
where
|
||||
T: GuestTypeClone<'a>,
|
||||
{
|
||||
pub fn clone_from_guest(&self) -> Result<T, GuestError> {
|
||||
pub fn read(&self) -> Result<T, GuestError> {
|
||||
T::read_from_guest(self)
|
||||
}
|
||||
}
|
||||
@@ -210,11 +210,11 @@ impl<'a, T> GuestPtrMut<'a, T>
|
||||
where
|
||||
T: GuestTypeClone<'a>,
|
||||
{
|
||||
pub fn read_ptr_from_guest(&self) -> Result<T, GuestError> {
|
||||
pub fn read(&self) -> Result<T, GuestError> {
|
||||
T::read_from_guest(&self.as_immut())
|
||||
}
|
||||
|
||||
pub fn write_ptr_to_guest(&self, ptr: &T) {
|
||||
pub fn write(&self, ptr: &T) {
|
||||
T::write_to_guest(ptr, &self);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user