ferroui_base/media/
immutable_geometry.rs1use crate::media::{Geometry, GeometryImpl};
2use crate::platform::IGeometryImpl;
3use crate::{ferro_class, ferro_impl_classes, instantiate, FerroObjectImpl, Ref};
4use std::sync::Arc;
5
6#[repr(C)]
8pub struct ImmutableGeometry {
9 base: Geometry,
10}
11
12ferro_class!(ImmutableGeometry: Geometry);
13ferro_impl_classes!(ImmutableGeometry: FerroObjectImpl);
14
15impl GeometryImpl for ImmutableGeometry {
16 fn clone_geometry(this: &Self) -> Ref<Geometry> {
17 ImmutableGeometry::new(this.platform_impl()).upcast()
18 }
19
20 fn create_defining_geometry(this: &Self) -> Option<Arc<dyn IGeometryImpl>> {
21 this.platform_impl()
22 }
23}
24
25impl ImmutableGeometry {
26 pub fn new(platform_impl: Option<Arc<dyn IGeometryImpl>>) -> Ref<Self> {
27 instantiate(Self { base: Geometry::construct_with_impl(platform_impl) })
28 }
29}