@@ -91,46 +91,6 @@ impl Runtime {
91
91
. unwrap_or ( Err ( Error :: FunctionNotFound ) )
92
92
}
93
93
94
- /// Searches for a module with the given name in the runtime's loaded modules.
95
- ///
96
- /// Using this over searching through [`Runtime::modules`] is a bit more efficient as it
97
- /// works on the underlying CStrings directly and doesn't require an upfront length calculation.
98
- ///
99
- /// [`Runtime::modules`]: struct.Runtime.html#method.modules
100
- pub fn find_module < ' rt > ( & ' rt self , name : & str ) -> Result < Module < ' rt > > {
101
- unsafe {
102
- let mut module = ptr:: NonNull :: new ( self . raw . as_ref ( ) . modules ) ;
103
- while let Some ( raw_mod) = module {
104
- if eq_cstr_str ( raw_mod. as_ref ( ) . name , name) {
105
- return Ok ( Module :: from_raw ( self , raw_mod. as_ptr ( ) ) ) ;
106
- }
107
-
108
- module = ptr:: NonNull :: new ( raw_mod. as_ref ( ) . next ) ;
109
- }
110
- Err ( Error :: ModuleNotFound )
111
- }
112
- }
113
-
114
- /// Returns an iterator over the runtime's loaded modules.
115
- pub fn modules < ' rt > ( & ' rt self ) -> impl Iterator < Item = Module < ' rt > > + ' rt {
116
- // pointer could get invalidated if modules can become unloaded
117
- // pushing new modules into the runtime while this iterator exists is fine as its backed by a linked list meaning it wont get invalidated.
118
- let mut module = unsafe { ptr:: NonNull :: new ( self . raw . as_ref ( ) . modules ) } ;
119
- core:: iter:: from_fn ( move || {
120
- let next = unsafe { module. and_then ( |module| ptr:: NonNull :: new ( module. as_ref ( ) . next ) ) } ;
121
- mem:: replace ( & mut module, next) . map ( |raw| Module :: from_raw ( self , raw. as_ptr ( ) ) )
122
- } )
123
- }
124
-
125
- /// Resizes the number of allocatable pages to num_pages.
126
- ///
127
- /// # Errors
128
- ///
129
- /// This function will error out if it failed to resize memory allocation.
130
- pub fn resize_memory ( & self , num_pages : u32 ) -> Result < ( ) > {
131
- Error :: from_ffi_res ( unsafe { ffi:: ResizeMemory ( self . raw . as_ptr ( ) , num_pages) } )
132
- }
133
-
134
94
/// Returns the raw memory of this runtime.
135
95
///
136
96
/// # Safety
@@ -160,26 +120,6 @@ impl Runtime {
160
120
} ;
161
121
ptr:: slice_from_raw_parts_mut ( data, len)
162
122
}
163
-
164
- /// Returns the stack of this runtime.
165
- pub fn stack ( & self ) -> * const [ ffi:: m3slot_t ] {
166
- unsafe {
167
- ptr:: slice_from_raw_parts (
168
- self . raw . as_ref ( ) . stack . cast :: < ffi:: m3slot_t > ( ) ,
169
- self . raw . as_ref ( ) . numStackSlots as usize ,
170
- )
171
- }
172
- }
173
-
174
- /// Returns the stack of this runtime.
175
- pub fn stack_mut ( & self ) -> * mut [ ffi:: m3slot_t ] {
176
- unsafe {
177
- ptr:: slice_from_raw_parts_mut (
178
- self . raw . as_ref ( ) . stack . cast :: < ffi:: m3slot_t > ( ) ,
179
- self . raw . as_ref ( ) . numStackSlots as usize ,
180
- )
181
- }
182
- }
183
123
}
184
124
185
125
impl Runtime {
0 commit comments