Trait abi_stable::abi_stability::extra_checks::TypeChecker [−][src]
pub unsafe trait TypeChecker: Send + Sync {
fn check_compatibility(
&mut self,
interface: &'static TypeLayout,
implementation: &'static TypeLayout
) -> RResult<(), ExtraChecksError>;
fn local_check_compatibility(
&mut self,
interface: &'static TypeLayout,
implementation: &'static TypeLayout
) -> RResult<(), ExtraChecksError>;
}
Expand description
This checks that the layout of types coming from dynamic libraries are compatible with those of the binary/dynlib that loads them.
Required methods
fn check_compatibility(
&mut self,
interface: &'static TypeLayout,
implementation: &'static TypeLayout
) -> RResult<(), ExtraChecksError>
fn check_compatibility(
&mut self,
interface: &'static TypeLayout,
implementation: &'static TypeLayout
) -> RResult<(), ExtraChecksError>
Checks that ìnterface
is compatible with implementation.
This is equivalent to check_layout_compatibility
,
except that it can also be called re-entrantly
(while check_layout_compatibility
cannot be called re-entrantly)
Errors
When calling the implementation of this trait used in check_layout_compatibility
,
the errors detected in this method are always propagated by the free function,
to prevent the propagation of errors call the local_check_compatibility
method.
fn local_check_compatibility(
&mut self,
interface: &'static TypeLayout,
implementation: &'static TypeLayout
) -> RResult<(), ExtraChecksError>
fn local_check_compatibility(
&mut self,
interface: &'static TypeLayout,
implementation: &'static TypeLayout
) -> RResult<(), ExtraChecksError>
Checks that ìnterface
is compatible with implementation.
This is equivalent to the check_compatibility
method,
except that it does not propagate errors automatically,
they must be returned as part of the error of the ExtraChecks
that calls this.