Hi all,
I'm reading through this section of the component-model guide, and I'm looking at the example blob resource:
resource blob {
constructor(init: list<u8>);
write: func(bytes: list<u8>);
read: func(n: u32) -> list<u8>;
merge: static func(lhs: blob, rhs: blob) -> blob;
}
If I try to implement this in rust, the generated GuestBlob
trait has read and write functions that look like:
fn write(&self, bytes: _rt::Vec<u8>);
fn read(&self, n: u32) -> _rt::Vec<u8>;
What if I want that to be a &mut self
? Is that possible?
Not directly; you can use interior mutability like RefCell
instead
Last updated: Nov 22 2024 at 17:03 UTC