Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Java bindings using short instead of boolean for some methods #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions bindings/frankenswig/type.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,42 @@ class ResultType(Type):
def __init__(self, wrapped):
super().__init__(wrapped.rust, wrapped.swig, wrapped.python, wrapped.default)
self.wrapped = wrapped

def wrap_c_value(self, value):
raise Exception("Results can only be returned")

def wrap_python_value(self, value):
raise Exception("Results can only be returned")

def unwrap_rust_value(self, value):
v = self.wrapped.unwrap_rust_value('v')
return f'check_result!({value}.map(|v| {v}), _default)'

def python_postfix(self):
return self.wrapped.python_postfix()

def to_swig(self):
'''Formatting for embedding in a swig .i file.'''
return self.wrapped.to_swig()

def to_c(self):
'''Formatting for embedding in c .h file.'''
return self.wrapped.to_c()

def to_rust(self):
'''Formatting for embedding in c .h file.'''
return self.wrapped.to_rust()

def to_python(self):
return self.wrapped.to_python()

def result(self):
return ResultType(self)

def orig_rust(self):
return self.wrapped.orig_rust()


# TODO: make sure this works with utf-8 stuff in python 2, java, etc.
class StringType(Type):
'''A rust String.'''
Expand Down