Struct gtk::Value
[−]
pub struct Value(_);
A generic value capable of carrying various types.
Once created the type of the value can't be changed.
Some types (e.g. String
and objects) support None
values while others
(e.g. numeric types) don't.
See the module documentation for more details.
Methods
impl Value
fn downcast<T>(self) -> Result<TypedValue<T>, Value> where T: FromValueOptional + SetValue
Tries to downcast to a TypedValue
.
Returns Ok(TypedValue<T>)
if the value carries a type corresponding
to T
and Err(self)
otherwise.
fn get<T>(&self) -> Option<T> where T: FromValueOptional
Tries to get a value of type T
.
Returns Some
if the type is correct and the value is not None
.
This function doesn't distinguish between type mismatches and correctly
typed None
values. Use downcast
or is
for that.
fn is<T>(&self) -> bool where T: FromValueOptional + SetValue
Returns true
if the type of the value corresponds to T
.
fn type_(&self) -> Type
Returns the type of the value.
fn type_transformable(src: Type, dst: Type) -> bool
Returns whether Value
s of type src
can be transformed to type dst
.
Trait Implementations
impl Uninitialized for Value
unsafe fn uninitialized() -> Value
Returns an uninitialized value.
impl Drop for Value
fn drop(&mut self)
impl ToValue for Value
fn to_value(&self) -> Value
Returns a Value
clone of self
.
fn to_value_type(&self) -> Type
Returns the type identifer of self
. Read more
impl Debug for Value
impl<'a> ToGlibPtr<'a, *const GValue> for Value
type Storage = &'a Value
fn to_glib_none(&'a self) -> Stash<'a, *const GValue, Value>
Transfer: none. Read more
fn to_glib_container(&'a self) -> Stash<'a, P, Self>
Transfer: container. Read more
fn to_glib_full(&self) -> P
Transfer: full. Read more
impl<'a, T> From<Option<&'a T>> for Value where T: SetValueOptional + ?Sized
impl<'a, T> From<&'a T> for Value where T: SetValue + ?Sized
impl<T> From<TypedValue<T>> for Value
fn from(value: TypedValue<T>) -> Value
impl<'a> ToGlibPtrMut<'a, *mut GValue> for Value
type Storage = &'a mut Value
fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut GValue, Value>
Transfer: none. Read more
impl Clone for Value
fn clone(&self) -> Value
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more