[−][src]Struct glib::value::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.
Value
does not implement the Send
trait, but SendValue
can be
used instead.
See the module documentation for more details.
Methods
impl Value
[src]
pub fn from_type(type_: Type) -> Self
[src]
Creates a new Value
that is initialized with type_
pub fn downcast<'a, T: FromValueOptional<'a> + SetValue>(
self
) -> Result<TypedValue<T>, Self>
[src]
self
) -> Result<TypedValue<T>, Self>
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 downcast_ref<'a, T: FromValueOptional<'a> + SetValue>(
&self
) -> Option<&TypedValue<T>>
[src]
&self
) -> Option<&TypedValue<T>>
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]
&'a self
) -> Result<Option<T>, GetError>
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 type_transformable(src: Type, dst: Type) -> bool
[src]
Returns whether Value
s of type src
can be transformed to type dst
.
pub fn transform<T: StaticType + SetValue>(&self) -> Option<Value>
[src]
Tries to transform the value into a value of the target type
pub fn try_into_send_value<'a, T: Send + FromValueOptional<'a> + SetValue>(
self
) -> Result<SendValue, Self>
[src]
self
) -> Result<SendValue, Self>
Trait Implementations
impl Clone for Value
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Value
[src]
impl Drop for Value
[src]
impl<'a, T: ?Sized + SetValue> From<&'a T> for Value
[src]
impl<'a, T: ?Sized + SetValueOptional> From<Option<&'a T>> for Value
[src]
impl From<SendValue> for Value
[src]
impl<T> From<TypedValue<T>> for Value
[src]
fn from(value: TypedValue<T>) -> 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]
ptr: *const *mut GValue,
num: usize
) -> Vec<Self>
unsafe fn from_glib_container_num_as_vec(
_: *const *mut GValue,
_: usize
) -> Vec<Self>
[src]
_: *const *mut GValue,
_: usize
) -> Vec<Self>
unsafe fn from_glib_full_num_as_vec(
_: *const *mut GValue,
_: usize
) -> Vec<Self>
[src]
_: *const *mut GValue,
_: usize
) -> Vec<Self>
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]
ptr: *mut *mut GValue,
num: usize
) -> Vec<Self>
unsafe fn from_glib_container_num_as_vec(
ptr: *mut *mut GValue,
num: usize
) -> Vec<Self>
[src]
ptr: *mut *mut GValue,
num: usize
) -> Vec<Self>
unsafe fn from_glib_full_num_as_vec(
ptr: *mut *mut GValue,
num: usize
) -> Vec<Self>
[src]
ptr: *mut *mut GValue,
num: usize
) -> Vec<Self>
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 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 FromGlibPtrFull<*mut GValue> for Value
[src]
unsafe fn from_glib_full(ptr: *mut GValue) -> Self
[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 ToValue for Value
[src]
impl Uninitialized for Value
[src]
unsafe fn uninitialized() -> Value
[src]
Auto Trait Implementations
impl RefUnwindSafe for Value
impl !Send for Value
impl !Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToValue for T where
T: SetValue + ?Sized,
[src]
T: SetValue + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,