#[repr(transparent)]
pub struct ConstantExpression { /* private fields */ }

Implementations

Similar to Self::value but panics if the value is of a different type.

Methods from Deref<Target = Expression>

Similar to Self::evaluate but panics if the value is of a different type.

Create a PropertyExpression that looks up for property_name with self as parameter. This is useful in long chains of Expressions.

Create a ClosureExpression from a glib::Closure with self as the second parameter and R as the return type. The return type is checked at run-time and must always be specified. This is useful in long chains of Expressions when using the glib::closure! macro.

Note that the first parameter will always be the this object bound to the expression. If None is passed as this then the type of the first parameter must be Option<glib::Object> otherwise type checking will panic.

use gtk::prelude::*;
use gtk::glib;
use glib::{closure, Object};

let button = gtk::Button::new();
button.set_label("Hello");
let label = button
    .property_expression("label")
    .chain_closure::<String>(closure!(|_: Option<Object>, label: &str| {
        format!("{} World", label)
    }))
    .evaluate_as::<String, _>(gtk::Widget::NONE);
assert_eq!(label.unwrap(), "Hello World");

Create a ClosureExpression with self as the second parameter. This is useful in long chains of Expressions.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Formats the value using the given formatter. Read more

Value type checker.

Get the contained value from a Value. Read more

Returns the type identifier of Self.

Convert a value to a Value.

Returns the type identifer of self. Read more

Convert an Option to a Value.

Type to get the Type from. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.