Struct glib::Value [] [src]

pub struct Value {
    // some fields omitted
}

Possible improvement : store a function pointer inside the struct and make the struct templated

Methods

impl Value

fn new() -> Value

fn init(&mut self, _type: Type)

Initializes value with the default value of type .

fn reset(&mut self)

Clears the current value in value and resets it to the default value (as if the value had just been initialized).

fn unset(&mut self)

Clears the current value in value and "unsets" the type, this releases all resources associated with this GValue. An unset value is the same as an uninitialized (zero-filled) GValue structure.

fn strdup_value_contents(&mut self) -> Option<String>

Return a newly allocated string, which describes the contents of a GValue. The main purpose of this function is to describe GValue contents for debugging output, the way in which the contents are described may change between different GLib versions.

fn set_long(&mut self, v_long: i64)

Set the contents of a G_TYPE_LONG GValue to v_long .

fn get_long(&self) -> i64

Get the contents of a G_TYPE_LONG GValue.

fn set_ulong(&mut self, v_ulong: u64)

Set the contents of a G_TYPE_ULONG GValue to v_ulong .

fn get_ulong(&self) -> u64

Get the contents of a G_TYPE_ULONG GValue.

fn set_enum(&mut self, v_enum: Type)

Set the contents of a G_TYPE_ENUM GValue to v_enum .

fn get_enum(&self) -> Type

Get the contents of a G_TYPE_ENUM GValue.

fn set_flags(&mut self, v_flags: Type)

Set the contents of a G_TYPE_FLAGS GValue to v_flags .

fn get_flags(&self) -> Type

Get the contents of a G_TYPE_FLAGS GValue.

fn get_string(&self) -> Option<String>

Get the contents of a G_TYPE_STRING GValue.

fn set_boxed<T>(&mut self, v_box: &T)

Set the contents of a G_TYPE_BOXED derived GValue to v_boxed .

fn get_boxed<'r, T>(&'r self) -> &'r T

Get the contents of a G_TYPE_BOXED derived GValue.

fn set_pointer<T>(&mut self, v_pointer: &T)

Set the contents of a pointer GValue to v_pointer .

fn get_pointer<'r, T>(&'r self) -> &'r T

Get the contents of a pointer GValue.

fn set_object<T>(&mut self, v_object: &T)

Set the contents of a G_TYPE_OBJECT derived GValue to v_object .

g_value_set_object() increases the reference count of v_object (the GValue holds a reference to v_object ). If you do not wish to increase the reference count of the object (i.e. you wish to pass your current reference to the GValue because you no longer need it), use g_value_take_object() instead.

It is important that your GValue holds a reference to v_object (either its own, or one it has taken) to ensure that the object won't be destroyed while the GValue still exists).

fn get_object<'r, T>(&'r self) -> &'r T

Get the contents of a G_TYPE_OBJECT derived GValue.

fn set<T: ValuePublic>(&mut self, val: &T)

fn get<T: ValuePublic>(&self) -> T

fn compatible(src_type: Type, dest_type: Type) -> bool

Returns whether a GValue of type src_type can be copied into a GValue of type dest_type .

fn transformable(src_type: Type, dest_type: Type) -> bool

Check whether g_value_transform() is able to transform values of type src_type into values of type dest_type . Note that for the types to be transformable, they must be compatible and a transform function must be registered.

fn as_ptr(&self) -> *const GValue

fn as_mut_ptr(&mut self) -> *mut GValue

Trait Implementations

impl Drop for Value

fn drop(&mut self)