#[repr(C, u8)]pub enum AbiProtocol {
RegularCall {
trait_object: TraitObject,
compatibility_mask: u64,
data: *const u8,
data_length: usize,
abi_result: *mut (),
receiver: unsafe extern "C" fn(outcome: *const RawAbiCallResult, result_receiver: *mut ()),
effective_version: u32,
method_number: u16,
},
InterrogateVersion {
schema_version_receiver: *mut u16,
abi_version_receiver: *mut u32,
},
InterrogateMethods {
schema_version_required: u16,
callee_schema_version_interrogated: u32,
result_receiver: *mut (),
callback: unsafe extern "C" fn(receiver: *mut (), callee_schema_version: u16, data: *const u8, len: usize),
},
CreateInstance {
trait_object_receiver: *mut TraitObject,
error_receiver: *mut (),
error_callback: unsafe extern "C" fn(error_receiver: *mut (), error: *const AbiErrorMsg),
},
DropInstance {
trait_object: TraitObject,
},
}Expand description
This struct carries all information between different libraries. I.e, it is the sole carrier of information accross an FFI-boundary.
Variants§
RegularCall
Call a method on a trait object.
Fields
trait_object: TraitObjectType-erased actual trait object. This is the 16 bytes o trait fat pointer.
compatibility_mask: u64For every argument, a bit ‘1’ if said argument is a reference that can just be binary copied, as a pointer
abi_result: *mut ()Instance of type AbiCallResult<T>, to which the return-value callback will
write deserialized results or panic-message.
InterrogateVersion
Get callee version
Fields
InterrogateMethods
Get schema
Fields
callee_schema_version_interrogated: u32The schema version that the caller expects the callee to communicate using. I.e, if callee has a later version of the ‘savefile’ library, this can be used to arrange for it to speak an older dialect. In theory, but savefile is still involving and there is always a risk that ABI-breaks will be necessary.
result_receiver: *mut ()A pointer pointing at the location that that caller will expect the return value to be written.
Note, callee does not actually write to this, it just calls callback, which allows caller
to write to the result_receiver. The field is still needed here, since the callback is a bare function,
and cannot capture any data.
CreateInstance
Create a new trait object.
Fields
trait_object_receiver: *mut TraitObjectPointer which will receive the fat pointer to the dyn trait object, allocated on heap using Box.
DropInstance
Drop a trait object.
Fields
trait_object: TraitObjectdyn trait fat pointer