MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / text_mut

Method text_mut

crates/wasmtime/src/runtime/code_memory.rs:564–570  ·  view source on GitHub ↗

Return a mutable borrow to the code, suitable for editing. Must not be published. # Panics This method panics if the code has been published (and not subsequently unpublished).

(&mut self)

Source from the content-addressed store, hash-verified

562 /// This method panics if the code has been published (and not
563 /// subsequently unpublished).
564 pub fn text_mut(&mut self) -> &mut [u8] {
565 assert!(!self.published);
566 // SAFETY: we assert !published, which means we either have
567 // not yet applied readonly + execute permissions, or we have
568 // undone that and flipped back to read-write via unpublish.
569 unsafe { &mut self.mmap.as_mut_slice()[self.text.clone()] }
570 }
571
572 unsafe fn register_unwind_info(&mut self) -> Result<()> {
573 if self.unwind.len() == 0 {

Callers 1

patchMethod · 0.80

Calls 2

as_mut_sliceMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected