pub trait SharedContext<E = <Self as Fallible>::Error> {
// Required methods
fn start_shared(
&mut self,
shared_type_id: TypeId,
ptr: ErasedPtr,
metadata_is_eq: unsafe fn(Metadata, Metadata) -> bool,
) -> Result<ValidationState, E>;
fn finish_shared(
&mut self,
shared_type_id: TypeId,
ptr: ErasedPtr,
) -> Result<(), E>;
}Expand description
A context that can validate shared archive memory.
Shared pointers require this kind of context to validate.
Required Methods§
Starts validating the value associated with an erased data pointer and shared pointer type.
The arguments to this method are relatively complex:
shared_type_idis the type of the shared pointer to start validatingptris an erased pointer to the data in the buffer that is sharedmetadata_is_eqis a comparison function called on potentially-equal data pointers
shared_type_id and ptr are used as a unique key to identify the
shared pointer. If the shared context finds another shared pointer with
the same shared type ID and data address, it will call metadata_is_eq
on the metadata of the existing shared pointer and the metadata of the
provided shared pointer.
Returns an error if the value associated with the given address was started with a different type ID.
Finishes validating the value associated with the given address.
Returns an error if the given address was not pending.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".