File Coverage

blib/lib/Wasm/Wasmtime/Store.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 22 22 100.0


line stmt bran cond sub pod time code
1             package Wasm::Wasmtime::Store;
2              
3 25     25   948067 use strict;
  25         80  
  25         846  
4 25     25   144 use warnings;
  25         105  
  25         618  
5 25     25   471 use 5.008004;
  25         92  
6 25     25   2310 use Wasm::Wasmtime::FFI;
  25         65  
  25         3412  
7 25     25   7147 use Wasm::Wasmtime::Engine;
  25         72  
  25         4905  
8              
9             # TODO: wasmtime_store_add_fuel
10             # TODO: wasmtime_store_fuel_consumed
11              
12             # ABSTRACT: Wasmtime store class
13             our $VERSION = '0.22'; # VERSION
14              
15              
16             $ffi_prefix = 'wasm_store_';
17             $ffi->load_custom_type('::PtrObject' => 'wasm_store_t' => __PACKAGE__);
18              
19              
20             $ffi->attach( new => ['wasm_engine_t'] => 'wasm_store_t' => sub {
21             my($xsub, $class, $engine) = @_;
22             $engine ||= Wasm::Wasmtime::Engine->new;
23             my $self = $xsub->($engine);
24             $self->{engine} = $engine;
25             $self;
26             });
27              
28              
29             $ffi->attach( [ wasmtime_store_gc => 'gc' ] => ['wasm_store_t'] => 'void' );
30              
31              
32 47     47 1 10557 sub engine { shift->{engine} }
33              
34             _generate_destroy();
35              
36             1;
37              
38             __END__