public class RustResult extends com.sun.jna.Structure implements Closeable
Pointer
s and String that map to a Rust Result.
A RustResult will contain either an ok value, OR an err value, or neither - never both.Modifier and Type | Class and Description |
---|---|
static class |
RustResult.ByReference |
static class |
RustResult.ByValue |
Constructor and Description |
---|
RustResult() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected List<String> |
getFieldOrder()
Return this Structure's field names in their proper order.
|
boolean |
isFailure()
Is there an error attached to this result?
|
boolean |
isSuccess()
Is there an value attached to this result
|
allocateMemory, allocateMemory, autoAllocate, autoRead, autoRead, autoWrite, autoWrite, cacheTypeInfo, calculateSize, clear, createFieldsOrder, createFieldsOrder, createFieldsOrder, createFieldsOrder, dataEquals, dataEquals, ensureAllocated, equals, fieldOffset, getAutoRead, getAutoWrite, getFieldList, getFields, getNativeAlignment, getNativeSize, getNativeSize, getPointer, getStringEncoding, getStructAlignment, hashCode, newInstance, newInstance, read, readField, readField, setAlignType, setAutoRead, setAutoSynch, setAutoWrite, setFieldOrder, setStringEncoding, size, sortFields, toArray, toArray, toString, toString, useMemory, useMemory, write, writeField, writeField, writeField
public com.sun.jna.Pointer ok
public String err
public boolean isSuccess()
public boolean isFailure()
protected List<String> getFieldOrder()
com.sun.jna.Structure
protected List getFieldOrder() {
return Arrays.asList(new String[] { ... });
}
IMPORTANT
When deriving from an existing Structure subclass, ensure that
you augment the list provided by the superclass, e.g.
protected List getFieldOrder() {
List fields = new ArrayList(super.getFieldOrder());
fields.addAll(Arrays.asList(new String[] { ... }));
return fields;
}
Field order must be explicitly indicated, since the
field order as returned by Class.getFields()
is not
guaranteed to be predictable.getFieldOrder
in class com.sun.jna.Structure
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException