# Struct glib::value::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]

#### `pub fn downcast<'a, T: FromValueOptional<'a> + SetValue>(
self
) -> Result<TypedValue<T>, Self>`
[src]

Tries to downcast to a `TypedValue`.

Returns `Ok(TypedValue<T>)` if the value carries a type corresponding to `T` and `Err(self)` otherwise.

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

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.

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

Returns `true` if the type of the value corresponds to `T`.

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

Returns the type of the value.

#### `pub fn type_transformable(src: Type, dst: Type) -> bool`
[src]

Returns whether `Value`s of type `src` can be transformed to type `dst`.

## Trait Implementations

### `impl Clone for Value`
[src]

#### `fn clone(&self) -> Self`
[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`
1.0.0
[src]

Performs copy-assignment from `source`. Read more

### `impl Drop for Value`
[src]

#### `fn drop(&mut self)`
[src]

Executes the destructor for this type. Read more

### `impl Debug for Value`
[src]

#### `fn fmt(&self, f: &mut Formatter) -> Result<(), Error>`
[src]

Formats the value using the given formatter. Read more

### `impl<'a, T: ?Sized + SetValueOptional> From<Option<&'a T>> for Value`
[src]

#### `fn from(value: Option<&'a T>) -> Self`
[src]

Performs the conversion.

### `impl<'a, T: ?Sized + SetValue> From<&'a T> for Value`
[src]

#### `fn from(value: &'a T) -> Self`
[src]

Performs the conversion.

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

#### `fn from(value: TypedValue<T>) -> Self`
[src]

Performs the conversion.

### `impl Uninitialized for Value`
[src]

#### `unsafe fn uninitialized() -> Value`
[src]

Returns an uninitialized value.

### `impl<'a> ToGlibPtr<'a, *const GValue> for Value`
[src]

#### `type Storage = &'a Value`

#### `fn to_glib_none(&'a self) -> Stash<'a, *const GValue, Self>`
[src]

Transfer: none. Read more

#### `fn to_glib_container(&'a self) -> Stash<'a, P, Self>`
[src]

Transfer: container. Read more

#### `fn to_glib_full(&self) -> P`
[src]

Transfer: full. Read more

### `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, Self>`
[src]

Transfer: none. Read more

### `impl<'a> ToGlibContainerFromSlice<'a, *mut GValue> for &'a Value`
[src]

#### `type Storage = &'a [&'a Value]`

#### `fn to_glib_none_from_slice(t: &'a [&'a Value]) -> (*mut GValue, &'a [&'a Value])`
[src]

#### `fn to_glib_container_from_slice(
t: &'a [&'a Value]
) -> (*mut GValue, &'a [&'a Value])`
[src]

#### `fn to_glib_full_from_slice(t: &[&'a Value]) -> *mut GValue`
[src]

### `impl<'a> ToGlibContainerFromSlice<'a, *const GValue> for &'a Value`
[src]

#### `type Storage = &'a [&'a Value]`

#### `fn to_glib_none_from_slice(
t: &'a [&'a Value]
) -> (*const GValue, &'a [&'a Value])`
[src]

#### `fn to_glib_container_from_slice(
_: &'a [&'a Value]
) -> (*const GValue, &'a [&'a Value])`
[src]

#### `fn to_glib_full_from_slice(_: &[&'a Value]) -> *const GValue`
[src]

### `impl FromGlibPtrNone<*const GValue> for Value`
[src]

#### `unsafe fn from_glib_none(ptr: *const GValue) -> Self`
[src]

### `impl FromGlibPtrNone<*mut GValue> for Value`
[src]

#### `unsafe fn from_glib_none(ptr: *mut GValue) -> Self`
[src]

### `impl FromGlibPtrFull<*mut GValue> for Value`
[src]

#### `unsafe fn from_glib_full(ptr: *mut GValue) -> Self`
[src]

### `impl FromGlibContainerAsVec<*mut GValue, *mut *mut GValue> for Value`
[src]

#### `unsafe fn from_glib_none_num_as_vec(
ptr: *mut *mut GValue,
num: usize
) -> Vec<Self>`
[src]

#### `unsafe fn from_glib_container_num_as_vec(
ptr: *mut *mut GValue,
num: usize
) -> Vec<Self>`
[src]

#### `unsafe fn from_glib_full_num_as_vec(
ptr: *mut *mut GValue,
num: usize
) -> Vec<Self>`
[src]

### `impl FromGlibPtrArrayContainerAsVec<*mut GValue, *mut *mut GValue> for Value`
[src]

#### `unsafe fn from_glib_none_as_vec(ptr: *mut *mut GValue) -> Vec<Self>`
[src]

#### `unsafe fn from_glib_container_as_vec(ptr: *mut *mut GValue) -> Vec<Self>`
[src]

#### `unsafe fn from_glib_full_as_vec(ptr: *mut *mut GValue) -> Vec<Self>`
[src]

### `impl FromGlibContainerAsVec<*mut GValue, *const *mut GValue> for Value`
[src]

#### `unsafe fn from_glib_none_num_as_vec(
ptr: *const *mut GValue,
num: usize
) -> Vec<Self>`
[src]

#### `unsafe fn from_glib_container_num_as_vec(
_: *const *mut GValue,
_: usize
) -> Vec<Self>`
[src]

#### `unsafe fn from_glib_full_num_as_vec(
_: *const *mut GValue,
_: usize
) -> Vec<Self>`
[src]

### `impl FromGlibPtrArrayContainerAsVec<*mut GValue, *const *mut GValue> for Value`
[src]

#### `unsafe fn from_glib_none_as_vec(ptr: *const *mut GValue) -> Vec<Self>`
[src]

#### `unsafe fn from_glib_container_as_vec(_: *const *mut GValue) -> Vec<Self>`
[src]

#### `unsafe fn from_glib_full_as_vec(_: *const *mut GValue) -> Vec<Self>`
[src]

### `impl ToValue for Value`
[src]

#### `fn to_value(&self) -> Value`
[src]

Returns a `Value` clone of `self`.

#### `fn to_value_type(&self) -> Type`
[src]

Returns the type identifer of `self`. Read more

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
↑
  Move up in search results
↓
  Move down in search results
↹
  Switch tab
⏎
  Go to active search result
+ / -
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)