Struct glib::char::UChar[][src]

pub struct UChar(pub c_uchar);
Expand description

Wrapper for values where C functions expect a plain C unsigned char

This UChar type is a wrapper over an libc::c_uchar, so that we can pass it to Glib or C functions. The check for whether a Rust char (a Unicode scalar value) actually fits in a libc::c_uchar is done in the new function; see its documentation for details.

The inner libc::c_uchar (which is equivalent to u8 can be extracted with .0, or by calling my_char.into_glib().

Examples

use glib::UChar;
use std::convert::TryFrom;

UChar::from(b'a');
UChar::try_from('a').unwrap();
assert!(UChar::try_from('☔').is_err());
extern "C" fn have_a_byte(b: libc::c_uchar);

have_a_byte(UChar::from(b'a').into_glib());

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

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

Performs the conversion.

Performs the conversion.

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)

recently added

Uses borrowed data to replace owned data, usually by cloning. 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.