Sha256: 3623c377ebac7ebe44b8eee68a2770b6d1a7980b208d5047dedc099cb94317f4

Contents?: true

Size: 1.49 KB

Versions: 25

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

require_relative "wasmtime/version"

# Tries to require the extension for the given Ruby version first
begin
  RUBY_VERSION =~ /(\d+\.\d+)/
  require "wasmtime/#{Regexp.last_match(1)}/wasmtime_rb"
rescue LoadError
  require "wasmtime/wasmtime_rb"
end

module Wasmtime
  class Error < StandardError; end

  # Raised when failing to convert the return value of a Ruby-backed Func to
  # Wasm types.
  class ResultError < Error; end

  # Raised when converting an {Extern} to its concrete type fails.
  class ConversionError < Error; end

  # Raised on Wasm trap.
  class Trap < Error
    STACK_OVERFLOW = :stack_overflow
    MEMORY_OUT_OF_BOUNDS = :memory_out_of_bounds
    HEAP_MISALIGNED = :heap_misaligned
    TABLE_OUT_OF_BOUNDS = :table_out_of_bounds
    INDIRECT_CALL_TO_NULL = :indirect_call_to_null
    BAD_SIGNATURE = :bad_signature
    INTEGER_OVERFLOW = :integer_overflow
    INTEGER_DIVISION_BY_ZERO = :integer_division_by_zero
    BAD_CONVERSION_TO_INTEGER = :bad_conversion_to_integer
    UNREACHABLE_CODE_REACHED = :unreachable_code_reached
    INTERRUPT = :interrupt
    ALWAYS_TRAP_ADAPTER = :always_trap_adapter
    OUT_OF_FUEL = :out_of_fuel
    UNKNOWN = :unknown
  end

  # Raised when a WASI program terminates early by calling +exit+.
  class WasiExit < Error
    # @return [Integer] The system exit code.
    attr_reader(:code)

    def initialize(code)
      @code = code
    end

    # @return [String]
    def message
      "WASI exit with code #{code}"
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
devcycle-ruby-server-sdk-2.0.0 vendor/bundle/ruby/3.0.0/gems/wasmtime-5.0.0-x86_64-linux/lib/wasmtime.rb
wasmtime-5.0.0 lib/wasmtime.rb
wasmtime-5.0.0-x86_64-linux lib/wasmtime.rb
wasmtime-5.0.0-x86_64-linux-musl lib/wasmtime.rb
wasmtime-5.0.0-x86_64-darwin lib/wasmtime.rb
wasmtime-5.0.0-x64-mingw32 lib/wasmtime.rb
wasmtime-5.0.0-x64-mingw-ucrt lib/wasmtime.rb
wasmtime-5.0.0-arm64-darwin lib/wasmtime.rb
wasmtime-5.0.0-aarch64-linux lib/wasmtime.rb
wasmtime-0.4.1 lib/wasmtime.rb
wasmtime-0.4.1-x86_64-linux lib/wasmtime.rb
wasmtime-0.4.1-x86_64-linux-musl lib/wasmtime.rb
wasmtime-0.4.1-x86_64-darwin lib/wasmtime.rb
wasmtime-0.4.1-x64-mingw32 lib/wasmtime.rb
wasmtime-0.4.1-x64-mingw-ucrt lib/wasmtime.rb
wasmtime-0.4.1-arm64-darwin lib/wasmtime.rb
wasmtime-0.4.1-aarch64-linux lib/wasmtime.rb
wasmtime-0.4.0 lib/wasmtime.rb
wasmtime-0.4.0-x86_64-linux lib/wasmtime.rb
wasmtime-0.4.0-x86_64-linux-musl lib/wasmtime.rb