0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-30 16:41:03 -05:00

get_module_requests_length should return usize (#151)

This commit is contained in:
Ry Dahl 2019-12-30 15:11:50 -05:00 committed by GitHub
parent 9a72f62bd6
commit 38057132cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,8 +24,7 @@ extern "C" {
fn v8__Module__GetStatus(this: *const Module) -> ModuleStatus; fn v8__Module__GetStatus(this: *const Module) -> ModuleStatus;
fn v8__Module__GetException(this: *const Module) -> *mut Value; fn v8__Module__GetException(this: *const Module) -> *mut Value;
fn v8__Module__GetModuleRequestsLength(this: *const Module) -> int; fn v8__Module__GetModuleRequestsLength(this: *const Module) -> int;
fn v8__Module__GetModuleRequest(this: *const Module, i: usize) fn v8__Module__GetModuleRequest(this: *const Module, i: int) -> *mut String;
-> *mut String;
fn v8__Module__GetModuleRequestLocation( fn v8__Module__GetModuleRequestLocation(
this: *const Module, this: *const Module,
i: usize, i: usize,
@ -87,14 +86,16 @@ impl Module {
} }
/// Returns the number of modules requested by this module. /// Returns the number of modules requested by this module.
pub fn get_module_requests_length(&self) -> int { pub fn get_module_requests_length(&self) -> usize {
unsafe { v8__Module__GetModuleRequestsLength(self) } unsafe { v8__Module__GetModuleRequestsLength(self) as usize }
} }
/// Returns the ith module specifier in this module. /// Returns the ith module specifier in this module.
/// i must be < self.get_module_requests_length() and >= 0. /// i must be < self.get_module_requests_length() and >= 0.
pub fn get_module_request(&self, i: usize) -> Local<String> { pub fn get_module_request(&self, i: usize) -> Local<String> {
unsafe { Local::from_raw(v8__Module__GetModuleRequest(self, i)).unwrap() } unsafe {
Local::from_raw(v8__Module__GetModuleRequest(self, i as int)).unwrap()
}
} }
/// Returns the source location (line number and column number) of the ith /// Returns the source location (line number and column number) of the ith