[][src]Struct glib::value::TypedValue

#[repr(C)]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.

Implementations

impl<'a, T: FromValueOptional<'a> + SetValue> TypedValue<T>[src]

pub fn get(&'a self) -> Option<T>[src]

Returns the value.

Types that don't support a None value always return Some. See get_some.

pub fn get_some(&'a self) -> T where
    T: FromValue<'a>, 
[src]

Returns the value.

This method is only available for types that don't support a None value.

pub fn set<U: ?Sized + SetValueOptional>(&mut self, value: Option<&U>) where
    T: Borrow<U>, 
[src]

Sets the value.

This method is only available for types that support a None value.

pub fn set_none(&mut self) where
    T: SetValueOptional
[src]

Sets the value to None.

This method is only available for types that support a None value.

pub fn set_some<U: ?Sized + SetValue>(&mut self, value: &U) where
    T: Borrow<U>, 
[src]

Sets the value.

impl<'a, T: FromValueOptional<'a> + SetValue + Send> TypedValue<T>[src]

pub fn into_send_value(self) -> SendValue[src]

Methods from Deref<Target = Value>

pub fn downcast_ref<'a, T: FromValueOptional<'a> + SetValue>(
    &self
) -> Option<&TypedValue<T>>
[src]

Tries to downcast to a &TypedValue.

Returns Some(&TypedValue<T>) if the value carries a type corresponding to T and None otherwise.

pub fn get<'a, T: FromValueOptional<'a>>(
    &'a self
) -> Result<Option<T>, GetError>
[src]

Tries to get a possibly optional value of type T.

Returns Ok if the type is correct.

pub fn get_some<'a, T: FromValue<'a>>(&'a self) -> Result<T, GetError>[src]

Tries to get a value of type T.

This method is only available for types that don't support a None value.

Returns Ok if the type is correct.

pub fn is<'a, T: FromValueOptional<'a> + SetValue>(&self) -> bool[src]

Returns true if the type of the value corresponds to T or is a sub-type of T.

pub fn type_(&self) -> Type[src]

Returns the type of the value.

pub fn transform<T: StaticType + SetValue>(&self) -> Option<Value>[src]

Tries to transform the value into a value of the target type

Trait Implementations

impl<T: Clone> Clone for TypedValue<T>[src]

impl<T> Debug for TypedValue<T>[src]

impl<T> Deref for TypedValue<T>[src]

type Target = Value

The resulting type after dereferencing.

impl<'a, T: FromValueOptional<'a> + SetValue> From<&'a T> for TypedValue<T>[src]

impl<'a> From<&'a str> for TypedValue<String>[src]

impl<'a, T: FromValueOptional<'a> + SetValueOptional> From<Option<&'a T>> for TypedValue<T>[src]

impl<'a> From<Option<&'a str>> for TypedValue<String>[src]

impl<'a> From<TypedValue<&'a str>> for TypedValue<String>[src]

impl<'a> From<TypedValue<String>> for TypedValue<&'a str>[src]

impl<T> From<TypedValue<T>> for Value[src]

impl<T: Send> From<TypedValue<T>> for SendValue[src]

impl<T: Send> Send for TypedValue<T>[src]

impl<T: Sync> Sync for TypedValue<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for TypedValue<T> where
    T: RefUnwindSafe

impl<T> Unpin for TypedValue<T>

impl<T> UnwindSafe for TypedValue<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.