pub trait SerializableExt: IsA<Serializable> + 'static {
// Provided methods
fn default_deserialize_property(
&self,
property_name: &str,
value: &mut Value,
pspec: impl AsRef<ParamSpec>,
property_node: &Node,
) -> bool { ... }
fn default_serialize_property(
&self,
property_name: &str,
value: &Value,
pspec: impl AsRef<ParamSpec>,
) -> Option<Node> { ... }
fn deserialize_property(
&self,
property_name: &str,
pspec: impl AsRef<ParamSpec>,
property_node: &Node,
) -> Option<Value> { ... }
fn find_property(&self, name: &str) -> Option<ParamSpec> { ... }
fn property(&self, pspec: impl AsRef<ParamSpec>) -> Value { ... }
fn list_properties(&self) -> Vec<ParamSpec> { ... }
fn serialize_property(
&self,
property_name: &str,
value: &Value,
pspec: impl AsRef<ParamSpec>,
) -> Option<Node> { ... }
fn set_property(&self, pspec: impl AsRef<ParamSpec>, value: &Value) { ... }
}Expand description
Provided Methods§
Sourcefn default_deserialize_property(
&self,
property_name: &str,
value: &mut Value,
pspec: impl AsRef<ParamSpec>,
property_node: &Node,
) -> bool
fn default_deserialize_property( &self, property_name: &str, value: &mut Value, pspec: impl AsRef<ParamSpec>, property_node: &Node, ) -> bool
Calls the default implementation of the vfunc::Json::Serializable::deserialize_property
virtual function.
This function can be used inside a custom implementation of the
deserialize_property() virtual function in lieu of calling the
default implementation through g_type_default_interface_peek():
⚠️ The following code is in c ⚠️
JsonSerializable *iface;
gboolean res;
iface = g_type_default_interface_peek (JSON_TYPE_SERIALIZABLE);
res = iface->deserialize_property (serializable, property_name,
value,
pspec,
property_node);§property_name
the name of the property to deserialize
§value
a pointer to an uninitialized value
§pspec
a property description
§property_node
the JSON node containing the serialized property
§Returns
TRUE if the property was successfully deserialized
Sourcefn default_serialize_property(
&self,
property_name: &str,
value: &Value,
pspec: impl AsRef<ParamSpec>,
) -> Option<Node>
fn default_serialize_property( &self, property_name: &str, value: &Value, pspec: impl AsRef<ParamSpec>, ) -> Option<Node>
Calls the default implementation of the vfunc::Json::Serializable::serialize_property
virtual function.
This function can be used inside a custom implementation of the
serialize_property() virtual function in lieu of calling the
default implementation through g_type_default_interface_peek():
⚠️ The following code is in c ⚠️
JsonSerializable *iface;
JsonNode *node;
iface = g_type_default_interface_peek (JSON_TYPE_SERIALIZABLE);
node = iface->serialize_property (serializable, property_name,
value,
pspec);This function will return NULL if the property could not be
serialized.
§property_name
the name of the property to serialize
§value
the value of the property to serialize
§pspec
a property description
§Returns
a node containing the serialized property
Sourcefn deserialize_property(
&self,
property_name: &str,
pspec: impl AsRef<ParamSpec>,
property_node: &Node,
) -> Option<Value>
fn deserialize_property( &self, property_name: &str, pspec: impl AsRef<ParamSpec>, property_node: &Node, ) -> Option<Value>
Asks a JsonSerializable implementation to deserialize the
property contained inside property_node and place its value
into value.
The value can be:
- an empty
GValueinitialized byG_VALUE_INIT, which will be automatically initialized with the expected type of the property by using the given property description (since JSON-GLib 1.6) - a
GValueinitialized with the expected type of the property
This function will not be called for properties that are marked as
as G_PARAM_CONSTRUCT_ONLY.
§property_name
the name of the property to serialize
§pspec
a property description
§property_node
the JSON node containing the serialized property
§Returns
TRUE if the property was successfully deserialized
§value
a pointer to an uninitialized value
Sourcefn find_property(&self, name: &str) -> Option<ParamSpec>
fn find_property(&self, name: &str) -> Option<ParamSpec>
Sourcefn list_properties(&self) -> Vec<ParamSpec>
fn list_properties(&self) -> Vec<ParamSpec>
Calls the vfunc::Json::Serializable::list_properties implementation on
the JsonSerializable instance, which will return the list of serializable
properties.
§Returns
the serializable properties of the object
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".