glib::value

Struct BoxedValue

Source
pub struct BoxedValue(pub Value);
Expand description

A Value containing another Value.

Tuple Fields§

§0: Value

Methods from Deref<Target = Value>§

Source

pub fn as_ptr(&self) -> *mut GValue

Source

pub fn get<'a, T>( &'a self, ) -> Result<T, <<T as FromValue<'_>>::Checker as ValueTypeChecker>::Error>
where T: FromValue<'a>,

Tries to get a value of type T.

Returns Ok if the type is correct.

Source

pub fn get_owned<T>( &self, ) -> Result<T, <<T as FromValue<'_>>::Checker as ValueTypeChecker>::Error>
where T: for<'b> FromValue<'b> + 'static,

Tries to get a value of an owned type T.

Source

pub fn is<T: StaticType>(&self) -> bool

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

Source

pub fn is_type(&self, type_: Type) -> bool

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

Source

pub fn type_(&self) -> Type

Returns the type of the value.

Source

pub fn transform<T: ValueType>(&self) -> Result<Value, BoolError>

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

Source

pub fn transform_with_type(&self, type_: Type) -> Result<Value, BoolError>

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

Trait Implementations§

Source§

impl Deref for BoxedValue

Source§

type Target = Value

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Value

Dereferences the value.
Source§

impl From<BoxedValue> for Value

Source§

fn from(v: BoxedValue) -> Self

Converts to this type from the input type.
Source§

impl<'a> FromValue<'a> for BoxedValue

Source§

type Checker = GenericValueTypeOrNoneChecker<BoxedValue>

Value type checker.
Source§

unsafe fn from_value(value: &'a Value) -> Self

Get the contained value from a Value. Read more
Source§

impl StaticType for BoxedValue

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl ToValue for BoxedValue

Source§

fn to_value(&self) -> Value

Convert a value to a Value.
Source§

fn value_type(&self) -> Type

Returns the type identifier of self. Read more
Source§

impl ToValueOptional for BoxedValue

Source§

fn to_value_optional(s: Option<&Self>) -> Value

Convert an Option to a Value.
Source§

impl ValueType for BoxedValue

Source§

type Type = BoxedValue

Type to get the Type from. Read more
Source§

impl ValueTypeOptional for BoxedValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoClosureReturnValue for T
where T: Into<Value>,

Source§

impl<T> StaticTypeExt for T
where T: StaticType,

Source§

fn ensure_type()

Ensures that the type has been registered with the type system.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T> TryFromClosureReturnValue for T
where T: for<'a> FromValue<'a> + StaticType + 'static,

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'a, T, C, E> FromValueOptional<'a> for T
where T: FromValue<'a, Checker = C>, C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError<E>>, E: Error + Send + 'static,