0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-24 15:19:31 -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__GetException(this: *const Module) -> *mut Value;
fn v8__Module__GetModuleRequestsLength(this: *const Module) -> int;
fn v8__Module__GetModuleRequest(this: *const Module, i: usize)
-> *mut String;
fn v8__Module__GetModuleRequest(this: *const Module, i: int) -> *mut String;
fn v8__Module__GetModuleRequestLocation(
this: *const Module,
i: usize,
@ -87,14 +86,16 @@ impl Module {
}
/// Returns the number of modules requested by this module.
pub fn get_module_requests_length(&self) -> int {
unsafe { v8__Module__GetModuleRequestsLength(self) }
pub fn get_module_requests_length(&self) -> usize {
unsafe { v8__Module__GetModuleRequestsLength(self) as usize }
}
/// Returns the ith module specifier in this module.
/// i must be < self.get_module_requests_length() and >= 0.
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