abi_stable::abi_stability::extra_checks

Trait ForExtraChecksImplementor

Source
pub trait ForExtraChecksImplementor: StableAbi + ExtraChecks {
    // Provided methods
    fn downcast_with_layout<F, R, E>(
        layout_containing_other: &'static TypeLayout,
        checker: TypeCheckerMut<'_>,
        f: F,
    ) -> RResult<R, ExtraChecksError>
       where Self: 'static,
             F: FnOnce(&Self, TypeCheckerMut<'_>) -> Result<R, E>,
             E: Send + Sync + ErrorTrait + 'static { ... }
    fn downcast_with_object<F, R, E>(
        other: ExtraChecksRef<'_>,
        checker: TypeCheckerMut<'_>,
        f: F,
    ) -> RResult<R, ExtraChecksError>
       where F: FnOnce(&Self, TypeCheckerMut<'_>) -> Result<R, E>,
             E: Send + Sync + ErrorTrait + 'static { ... }
}
Expand description

An extension trait for ExtraChecks implementors.

Provided Methods§

Source

fn downcast_with_layout<F, R, E>( layout_containing_other: &'static TypeLayout, checker: TypeCheckerMut<'_>, f: F, ) -> RResult<R, ExtraChecksError>
where Self: 'static, F: FnOnce(&Self, TypeCheckerMut<'_>) -> Result<R, E>, E: Send + Sync + ErrorTrait + 'static,

Accesses the ExtraChecks field in layout_containing_other, downcasted into Self.

If the closure returns an ExtraChecksError,it’ll be returned unmodified and unwrapped.

§Returns
  • ROk(_): If other was downcasted to Self,and f did not return any errors.

  • RErr(ExtraChecksError::NoneExtraChecks): Iflayout_containing_other does not contain an ExtraChecks trait object.

  • RErr(ExtraChecksError::TypeChecker): If there is an error while type checking.

  • RErr(ExtraChecksError::ExtraChecks(_)): If there is an custom error within the function.

Source

fn downcast_with_object<F, R, E>( other: ExtraChecksRef<'_>, checker: TypeCheckerMut<'_>, f: F, ) -> RResult<R, ExtraChecksError>
where F: FnOnce(&Self, TypeCheckerMut<'_>) -> Result<R, E>, E: Send + Sync + ErrorTrait + 'static,

Allows one to access other downcast into Self.

If the closure returns an ExtraChecksError,it’ll be returned unmodified and unwrapped.

§Returns
  • ROk(_): If other could be downcasted to Self,and f did not return any errors.

  • RErr(ExtraChecksError::TypeChecker): If there is an error while type checking.

  • RErr(ExtraChecksError::ExtraChecks(_)): If there is an custom error within the function.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<This> ForExtraChecksImplementor for This
where This: ?Sized + StableAbi + ExtraChecks,