Struct gtk::TypedValue
[−]
[src]
pub struct TypedValue<T>(_, _);
A statically typed Value
.
It dereferences to Value
and can be used everywhere Value
references are
accepted.
See the module documentation for more details.
Methods
impl<'a, T> TypedValue<T> where
T: FromValueOptional<'a> + SetValue,
[src]
T: FromValueOptional<'a> + SetValue,
fn get(&'a self) -> Option<T>
Returns the value.
Types that don't support a None
value always return Some
. See
get_some
.
fn get_some(&'a self) -> T where
T: FromValue<'a>,
T: FromValue<'a>,
Returns the value.
This method is only available for types that don't support a None
value.
fn set<U>(&mut self, value: Option<&U>) where
T: Borrow<U>,
U: SetValueOptional + ?Sized,
T: Borrow<U>,
U: SetValueOptional + ?Sized,
Sets the value.
This method is only available for types that support a None
value.
fn set_none(&mut self) where
T: SetValueOptional,
T: SetValueOptional,
Sets the value to None
.
This method is only available for types that support a None
value.
fn set_some<U>(&mut self, value: &U) where
T: Borrow<U>,
U: SetValue + ?Sized,
T: Borrow<U>,
U: SetValue + ?Sized,
Sets the value.
Methods from Deref<Target = Value>
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.
Trait Implementations
impl<T> DerefMut for TypedValue<T>
[src]
impl<T> Clone for TypedValue<T>
[src]
fn clone(&self) -> TypedValue<T>
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<T> Deref for TypedValue<T>
[src]
impl<T> Debug for TypedValue<T>
[src]
impl<'a> From<&'a str> for TypedValue<String>
[src]
fn from(value: &'a str) -> TypedValue<String>
impl<'a> From<Option<&'a str>> for TypedValue<String>
[src]
fn from(value: Option<&'a str>) -> TypedValue<String>
impl<'a, T> From<Option<&'a T>> for TypedValue<T> where
T: FromValueOptional<'a> + SetValueOptional,
[src]
T: FromValueOptional<'a> + SetValueOptional,
fn from(value: Option<&'a T>) -> TypedValue<T>
impl<'a, T> From<&'a T> for TypedValue<T> where
T: FromValueOptional<'a> + SetValue,
[src]
T: FromValueOptional<'a> + SetValue,