Put context object behind a ref rather than mut ref
This commit puts context object, i.e., the implementor of the WASI snapshot, behind a reference `&self` rather than a mutable reference `&mut self`. As suggested by @alexcrichton, this gives the implementor the possibility to determine how it handles its interior mutability.
This commit is contained in:
@@ -11,7 +11,7 @@ impl_errno!(types::Errno);
|
||||
|
||||
impl arrays::Arrays for WasiCtx {
|
||||
fn reduce_excuses(
|
||||
&mut self,
|
||||
&self,
|
||||
excuses: &types::ConstExcuseArray,
|
||||
) -> Result<types::Excuse, types::Errno> {
|
||||
let last = GuestType::read(
|
||||
@@ -25,7 +25,7 @@ impl arrays::Arrays for WasiCtx {
|
||||
Ok(*last.as_ref().expect("dereferencing ptr should succeed"))
|
||||
}
|
||||
|
||||
fn populate_excuses(&mut self, excuses: &types::ExcuseArray) -> Result<(), types::Errno> {
|
||||
fn populate_excuses(&self, excuses: &types::ExcuseArray) -> Result<(), types::Errno> {
|
||||
for excuse in excuses.iter() {
|
||||
let ptr_to_ptr = GuestType::read(&excuse.expect("valid ptr to ptr"))
|
||||
.expect("valid ptr to some Excuse value");
|
||||
|
||||
Reference in New Issue
Block a user