Skip to content

Commit

Permalink
Fix Java bindings using short instead of boolean for some methods
Browse files Browse the repository at this point in the history
  • Loading branch information
HalfVoxel committed Jan 14, 2018
1 parent b655ea6 commit a431e69
Showing 1 changed file with 25 additions and 3 deletions.
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

0 comments on commit a431e69

Please sign in to comment.