Struct Resource
pub struct Resource(/* private fields */);Expand description
Represents the base class for all resources. This base class contains information related to the type of the resource and the loading status of the resource data. The actual resource data is specific to the sub-classes.
Implementations§
Methods from Deref<Target = Object>§
pub fn as_ptr(&self) -> *mut ObjectWrapper
pub fn as_wrapper(&self) -> &ObjectWrapper
pub fn as_object(&self) -> &Object
pub fn as_object(&self) -> &Object
Represents any type inheriting from Object as &Object.
This is useful for comparisions when PartialEq traits failed to compare objects of
different types.
let child = screen.get_child(0)?;
let parent = child.get_parent()?.into_error(ErrorKind::ObjectNotFound)?;
// assert_eq!(screen, parent); // <- Fails to compile!
assert_eq!(screen.as_object(), parent.as_object());pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
Gets a pointer to the backing C++ instance.
pub fn get_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<<T as VariantConstraint>::RetArg, Error>where
T: PropertyTypeConstraint,
pub fn get_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<<T as VariantConstraint>::RetArg, Error>where
T: PropertyTypeConstraint,
Returns the current value of a property disregarding modifiers.
Base value is affected by the following inputs where the highest entry in the list determines the base value:
- Local value set with setProperty or loaded from kzb
- Value set by a style affecting the property.
- Value defined by class metadata.
Modifiers are not applied, the highest-priority base value is returned.
If no inputs to the property value can be established the system returns the value default value from property type metadata.
§Arguments
property_type- The property type identifying the property to retrieve.
§Returns
The evaluated property value.
pub fn get_optional_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<Option<<T as VariantConstraint>::RetArg>, Error>where
T: PropertyTypeConstraint,
pub fn get_optional_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<Option<<T as VariantConstraint>::RetArg>, Error>where
T: PropertyTypeConstraint,
Returns the current value of a property disregarding modifiers, but does not default to the value in property metadata if there are no inputs to the property value.
If there is no value sources, None is returned.
If no inputs to the property value can be established the system returns the value default value from property type metadata.
§Arguments
property_type- The property type identifying the property to retrieve.
§Returns
The evaluated property value.
pub fn set_property<T>(
&self,
property_type: &PropertyType<T>,
value: <T as VariantConstraint>::DataArg<'_>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn set_property<T>(
&self,
property_type: &PropertyType<T>,
value: <T as VariantConstraint>::DataArg<'_>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Sets the local value of a property type.
pub fn has_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<bool, Error>where
T: PropertyTypeConstraint,
pub fn has_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<bool, Error>where
T: PropertyTypeConstraint,
Evaluates whether there are any inputs into the property value. Both value sources and modifiers are taken into account.
§Returns
Returns true if there are inputs into the property value, false otherwise.
pub fn remove_local_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn remove_local_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Removes the local value associated with the property.
pub fn get_metaclass(&self) -> Result<Metaclass, Error>
pub fn get_metaclass(&self) -> Result<Metaclass, Error>
Returns the metaclass of the dynamic type of the object.
pub fn get_domain(&self) -> Result<Domain, Error>
pub fn get_domain(&self) -> Result<Domain, Error>
Returns the domain the object belongs to.
pub fn set_flag_keep_during_patching<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn set_flag_keep_during_patching<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Sets the flag to indicate that the property was loaded from KZB.
pub fn debug_string(&self) -> Result<String, Error>
pub fn debug_string(&self) -> Result<String, Error>
Builds a string representation of the object intended for debugging purposes.
Trait Implementations§
§impl Inheritable for Resource
impl Inheritable for Resource
§unsafe fn downcast_unchecked<T>(self) -> Twhere
T: Inherits<Self>,
unsafe fn downcast_unchecked<T>(self) -> Twhere
T: Inherits<Self>,
§unsafe fn downcast_unchecked_ref<T>(&self) -> &Twhere
T: Inherits<Self>,
unsafe fn downcast_unchecked_ref<T>(&self) -> &Twhere
T: Inherits<Self>,
§impl Inherits<Resource> for AnimationResource
impl Inherits<Resource> for AnimationResource
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for BinaryResource
impl Inherits<Resource> for BinaryResource
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for BitmapFontFile
impl Inherits<Resource> for BitmapFontFile
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for BlitRenderPass
impl Inherits<Resource> for BlitRenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for BlurEffect2D
impl Inherits<Resource> for BlurEffect2D
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for ClearRenderPass
impl Inherits<Resource> for ClearRenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for ColorBrush
impl Inherits<Resource> for ColorBrush
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for CompositionBrush
impl Inherits<Resource> for CompositionBrush
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for CompositionTargetRenderPass
impl Inherits<Resource> for CompositionTargetRenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for ContentBrush
impl Inherits<Resource> for ContentBrush
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for CubeMapRenderPass
impl Inherits<Resource> for CubeMapRenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for DataContext
impl Inherits<Resource> for DataContext
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for DataObject<()>
impl Inherits<Resource> for DataObject<()>
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl<T> Inherits<Resource> for DataObject<T>where
T: DataObjectConstraint,
impl<T> Inherits<Resource> for DataObject<T>where
T: DataObjectConstraint,
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for DataObjectList
impl Inherits<Resource> for DataObjectList
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for DataSource
impl Inherits<Resource> for DataSource
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for DrawObjectsRenderPass
impl Inherits<Resource> for DrawObjectsRenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for DrawObjectsWithMaterialRenderPass
impl Inherits<Resource> for DrawObjectsWithMaterialRenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for EffectStack2D
impl Inherits<Resource> for EffectStack2D
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for FontFamily
impl Inherits<Resource> for FontFamily
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for Framebuffer
impl Inherits<Resource> for Framebuffer
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for GPUResource
impl Inherits<Resource> for GPUResource
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for GatherLightsRenderPass
impl Inherits<Resource> for GatherLightsRenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for GatherNearestLightsRenderPass
impl Inherits<Resource> for GatherNearestLightsRenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for LegacyRenderPass
impl Inherits<Resource> for LegacyRenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for MaskEffect2D
impl Inherits<Resource> for MaskEffect2D
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for MaterialBrush
impl Inherits<Resource> for MaterialBrush
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for MaterialSetupRenderPass
impl Inherits<Resource> for MaterialSetupRenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for NodeEffect2D
impl Inherits<Resource> for NodeEffect2D
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for NodeEffectPrefab2D
impl Inherits<Resource> for NodeEffectPrefab2D
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for NodeListRenderPass
impl Inherits<Resource> for NodeListRenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for ObjectSource
impl Inherits<Resource> for ObjectSource
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for OutlineEffect2D
impl Inherits<Resource> for OutlineEffect2D
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for PageTransitionCollection
impl Inherits<Resource> for PageTransitionCollection
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for PipelineStateRenderPass
impl Inherits<Resource> for PipelineStateRenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for PrefabTemplate
impl Inherits<Resource> for PrefabTemplate
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for PrefabTemplateNode
impl Inherits<Resource> for PrefabTemplateNode
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for RenderPass
impl Inherits<Resource> for RenderPass
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for RenderPassPrefab
impl Inherits<Resource> for RenderPassPrefab
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for RenderPassView
impl Inherits<Resource> for RenderPassView
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for Renderbuffer
impl Inherits<Resource> for Renderbuffer
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for ResourceDictionary
impl Inherits<Resource> for ResourceDictionary
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for ResourceDictionarySelector
impl Inherits<Resource> for ResourceDictionarySelector
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for ShaderProgram
impl Inherits<Resource> for ShaderProgram
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for ShadowEffect2D
impl Inherits<Resource> for ShadowEffect2D
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for StateManager
impl Inherits<Resource> for StateManager
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for TextResource
impl Inherits<Resource> for TextResource
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for TextureBrush
impl Inherits<Resource> for TextureBrush
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for TimelineResource
impl Inherits<Resource> for TimelineResource
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl Inherits<Resource> for Trajectory
impl Inherits<Resource> for Trajectory
fn upcast(self) -> Base
fn upcast_ref(&self) -> &Base
§impl MetaclassConstraint for Resource
impl MetaclassConstraint for Resource
§fn get_static_metaclass() -> &'static Metaclass
fn get_static_metaclass() -> &'static Metaclass
§impl ObjectConstraint for Resource
impl ObjectConstraint for Resource
§fn downcast<T>(self) -> Result<Option<T>, Error>where
T: MetaInherits<Self>,
fn downcast<T>(self) -> Result<Option<T>, Error>where
T: MetaInherits<Self>,
§fn downcast_ref<T>(&self) -> Result<Option<&T>, Error>where
T: MetaInherits<Self>,
fn downcast_ref<T>(&self) -> Result<Option<&T>, Error>where
T: MetaInherits<Self>,
§fn is_a<T>(&self) -> Result<bool, Error>where
T: MetaInherits<Self>,
fn is_a<T>(&self) -> Result<bool, Error>where
T: MetaInherits<Self>,
fn downgrade(self) -> Weak<Self>
fn downgrade_ref(&self) -> Weak<Self>
fn lock(self) -> ThreadObject<Self>
fn lock_ref(&self) -> ThreadObject<Self>
§impl<T> PartialEq<T> for Resourcewhere
T: ObjectConstraint,
impl<T> PartialEq<T> for Resourcewhere
T: ObjectConstraint,
§impl<T> PartialEq<Weak<T>> for Resourcewhere
T: ObjectConstraint,
impl<T> PartialEq<Weak<T>> for Resourcewhere
T: ObjectConstraint,
§impl VariantConstraint for Resource
impl VariantConstraint for Resource
§type DataArg<'a> = Option<&'a Resource>
type DataArg<'a> = Option<&'a Resource>
Variant.
Generally, this type matches Self, except for KanziString, Resource, and ResourceId. Read more