pub struct AnyValue { /* private fields */ }
Expand description
A container type that allows storing any 'static
type that implements Any
and Clone
to be
stored in a Value
.
See the module documentation for more details.
Examples
use glib::prelude::*; // or `use gtk::prelude::*;`
use glib::{AnyValue, Value};
// Store a Rust string inside a Value
let v = AnyValue::new(String::from("123")).to_value();
// Retrieve the Rust String from the the Value again
let any_v = v.get::<&AnyValue>()
.expect("Value did not actually contain an AnyValue");
assert_eq!(any_v.downcast_ref::<String>(), Some(&String::from("123")));
Implementations
Trait Implementations
sourceimpl<'a> FromValueOptional<'a> for &'a AnyValue
impl<'a> FromValueOptional<'a> for &'a AnyValue
unsafe fn from_value_optional(value: &'a Value) -> Option<Self>
sourceimpl StaticType for AnyValue
impl StaticType for AnyValue
sourcefn static_type() -> Type
fn static_type() -> Type
Returns the type identifier of
Self
.Auto Trait Implementations
impl !RefUnwindSafe for AnyValue
impl !Send for AnyValue
impl !Sync for AnyValue
impl Unpin for AnyValue
impl !UnwindSafe for AnyValue
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more