Skip to main content

ObjectType

Trait ObjectType 

Source
pub unsafe trait ObjectType:
    StaticType
    + Upcast<FerroObject>
    + Sized {
    type Parent: ObjectType;
    type VTable: Copy + 'static;

    // Required methods
    fn vtable() -> &'static Self::VTable;
    fn register_class();
}
Expand description

Implemented by every class.

§Safety

Implemented only by [ferro_class!] (and by hand for the root class). Implementors guarantee that:

  • Self is #[repr(C)]-compatible with Parent at offset zero, i.e. a pointer to Self is a valid pointer to every class in its ancestor chain;
  • VTable likewise starts with Parent::VTable at offset zero;
  • values of Self are only created through instantiate (class structs have a private base field and construct-style constructors that are only meaningful inside instantiate).

Required Associated Types§

Source

type Parent: ObjectType

The base class. The root class is its own parent.

Source

type VTable: Copy + 'static

The virtual table of the class.

Required Methods§

Source

fn vtable() -> &'static Self::VTable

The virtual table used by instances whose most-derived class is Self.

Source

fn register_class()

The static initialisation of the class. The first call on a thread, after doing the same for the base class:

  1. makes the type known by name (TypeInfo::find);
  2. registers the handle type Ref<Self> and the interface handles the class declares ([ferro_class_info!]) with the untyped value conversions;
  3. registers the properties of the class in declaration order (ferro_properties!);
  4. runs the static constructor of the class (ClassDefaults::static_constructor).

Later calls only read a thread-local flag.

Generated by ferro_class!. Called by instantiate, so a class that has an instance on the thread is initialised, and through TypeInfo::ensure_class_init by property accessors and the property registry, for classes that have none.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ObjectType for Animatable

Source§

impl ObjectType for Animation

Source§

impl ObjectType for AnimatorKeyFrame

Source§

impl ObjectType for ArcSegment

Source§

impl ObjectType for BezierSegment

Source§

impl ObjectType for BitmapCache

Source§

impl ObjectType for BlurEffect

Source§

impl ObjectType for BoolTransition

Source§

impl ObjectType for BoxShadowsTransition

Source§

impl ObjectType for Brush

Source§

impl ObjectType for BrushTransition

Source§

impl ObjectType for CacheMode

Source§

type Parent = StyledElement

Source§

type VTable = CacheModeVTable

Source§

impl ObjectType for ColorTransition

Source§

impl ObjectType for CombinedGeometry

Source§

impl ObjectType for ConicGradientBrush

Source§

impl ObjectType for ContainerQuery

Source§

impl ObjectType for ControlTheme

Source§

impl ObjectType for CornerRadiusTransition

Source§

impl ObjectType for CroppedBitmap

Source§

impl ObjectType for DashStyle

Source§

impl ObjectType for DoubleTransition

Source§

impl ObjectType for Drawing

Source§

impl ObjectType for DrawingBrush

Source§

impl ObjectType for DrawingGroup

Source§

impl ObjectType for DrawingImage

Source§

impl ObjectType for DropShadowDirectionEffect

Source§

impl ObjectType for DropShadowEffect

Source§

impl ObjectType for DropShadowEffectBase

Source§

impl ObjectType for Effect

Source§

impl ObjectType for EffectTransition

Source§

impl ObjectType for EllipseGeometry

Source§

impl ObjectType for ExperimentalAcrylicMaterial

Source§

impl ObjectType for FerroObject

Source§

impl ObjectType for FloatTransition

Source§

impl ObjectType for Geometry

Source§

impl ObjectType for GeometryDrawing

Source§

impl ObjectType for GeometryGroup

Source§

impl ObjectType for GestureRecognizer

Source§

impl ObjectType for GlyphRunDrawing

Source§

impl ObjectType for GradientBrush

Source§

impl ObjectType for GradientStop

Source§

impl ObjectType for ImageBrush

Source§

impl ObjectType for ImageDrawing

Source§

impl ObjectType for ImmutableGeometry

Source§

impl ObjectType for InputElement

Source§

impl ObjectType for IntegerTransition

Source§

impl ObjectType for Interactive

Source§

impl ObjectType for KeyBinding

Source§

impl ObjectType for KeyFrame

Source§

impl ObjectType for KeySpline

Source§

impl ObjectType for Layoutable

Source§

impl ObjectType for LineGeometry

Source§

impl ObjectType for LineSegment

Source§

impl ObjectType for LinearGradientBrush

Source§

impl ObjectType for MatrixTransform

Source§

impl ObjectType for PathFigure

Source§

impl ObjectType for PathGeometry

Source§

impl ObjectType for PathSegment

Source§

impl ObjectType for Pen

Source§

impl ObjectType for PinchGestureRecognizer

Source§

impl ObjectType for PlatformGeometry

Source§

impl ObjectType for PointTransition

Source§

impl ObjectType for PolyBezierSegment

Source§

impl ObjectType for PolyLineSegment

Source§

impl ObjectType for PolylineGeometry

Source§

impl ObjectType for PullGestureRecognizer

Source§

impl ObjectType for QuadraticBezierSegment

Source§

impl ObjectType for RadialGradientBrush

Source§

impl ObjectType for RectangleGeometry

Source§

impl ObjectType for RelativePointTransition

Source§

impl ObjectType for ResourceDictionary

Source§

impl ObjectType for ResourceProvider

Source§

impl ObjectType for Rotate3DTransform

Source§

impl ObjectType for RotateTransform

Source§

impl ObjectType for ScaleTransform

Source§

impl ObjectType for ScrollGestureRecognizer

Source§

impl ObjectType for SizeTransition

Source§

impl ObjectType for SkewTransform

Source§

impl ObjectType for SolidColorBrush

Source§

impl ObjectType for StreamGeometry

Source§

impl ObjectType for Style

Source§

impl ObjectType for StyleBase

Source§

impl ObjectType for StyledElement

Source§

impl ObjectType for Styles

Source§

impl ObjectType for SwipeGestureRecognizer

Source§

impl ObjectType for TextDecoration

Source§

impl ObjectType for ThicknessTransition

Source§

impl ObjectType for TileBrush

Source§

impl ObjectType for Transform

Source§

impl ObjectType for TransformGroup

Source§

impl ObjectType for TransformOperationsTransition

Source§

impl ObjectType for TransitionBase

Source§

impl ObjectType for TranslateTransform

Source§

impl ObjectType for VectorTransition

Source§

impl ObjectType for Visual

Source§

impl ObjectType for VisualBrush