Struct gtk::Value
[−]
[src]
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
[src]
fn downcast<'a, T>(self) -> Result<TypedValue<T>, Value> where
T: FromValueOptional<'a> + SetValue,
[−]
T: FromValueOptional<'a> + 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<'a, T>(&'a self) -> Option<T> where
T: FromValueOptional<'a>,
[−]
T: FromValueOptional<'a>,
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<'a, T>(&self) -> bool where
T: FromValueOptional<'a> + SetValue,
[−]
T: FromValueOptional<'a> + 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 ToValue for Value
[src]
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 FromGlibPtrFull<*mut GValue> for Value
[src]
unsafe fn from_glib_full(ptr: *mut GValue) -> Value
impl Drop for Value
[src]
fn drop(&mut self)
impl Clone for Value
[src]
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
impl Uninitialized for Value
[src]
unsafe fn uninitialized() -> Value
[−]
Returns an uninitialized value.
impl Debug for Value
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[−]
Formats the value using the given formatter.
impl<'a, T> From<&'a T> for Value where
T: SetValue + ?Sized,
[src]
T: SetValue + ?Sized,
impl<T> From<TypedValue<T>> for Value
[src]
fn from(value: TypedValue<T>) -> Value
impl<'a, T> From<Option<&'a T>> for Value where
T: SetValueOptional + ?Sized,
[src]
T: SetValueOptional + ?Sized,
impl<'a> ToGlibPtrMut<'a, *mut GValue> for Value
[src]
type Storage = &'a mut Value
fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut GValue, Value>
[−]
Transfer: none. Read more