glib::value

Struct SendValue

Source
pub struct SendValue { /* private fields */ }
Expand description

A version of Value for storing Send types, that implements Send itself.

See the module documentation for more details.

GLib type: Inline allocated boxed type with stack copy semantics.

Implementations§

Source§

impl SendValue

Source

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

Source

pub unsafe fn from_glib_ptr_borrow<'a>(ptr: *const GValue) -> &'a Self

Borrows the underlying C value.

Source

pub unsafe fn from_glib_ptr_borrow_mut<'a>(ptr: *mut GValue) -> &'a mut Self

Borrows the underlying C value mutably.

Source§

impl SendValue

Source

pub fn into_raw(self) -> GValue

Consumes SendValue and returns the corresponding GValue.

Source

pub fn from_owned<T: Send + Into<Value>>(t: T) -> Self

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<'a>>::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 Tries to cast the contents of self into a type appropriate to store in dest_value, e.g. to transform a G_TYPE_INT value into a G_TYPE_FLOAT value. Performing transformations between value types might incur precision lossage. Especially transformations into strings might reveal seemingly arbitrary results and shouldn’t be relied upon for production code (such as rcfile value or object property serialization).

§dest_value

Target value.

§Returns

Whether a transformation rule was found and could be applied. Upon failing transformations, dest_value is left untouched.

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 Clone for SendValue

Source§

fn clone(&self) -> Self

Copies the inline boxed type by value with the type-specific copy function.

1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SendValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Deref for SendValue

Source§

type Target = Value

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Value

Dereferences the value.
Source§

impl Drop for SendValue

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a, T: ?Sized + ToSendValue> From<&'a T> for SendValue

Source§

fn from(value: &'a T) -> Self

Converts to this type from the input type.
Source§

impl From<SendValue> for Value

Source§

fn from(value: SendValue) -> Self

Converts to this type from the input type.
Source§

impl ToValue for &SendValue

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 ToValue for SendValue

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 Send for SendValue

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSendValue for T
where T: Send + ToValue + ?Sized,

Source§

fn to_send_value(&self) -> SendValue

Returns a SendValue clone of self.
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, 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.