Struct glib::char::UChar [−][src]
pub struct UChar(pub c_uchar);
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.to_glib().
Methods
impl UChar[src]
impl UCharpub fn new(c: char) -> Option<UChar>[src]
pub fn new(c: char) -> Option<UChar>Creates a Some(UChar) if the given char is representable as an libc::c_uchar
Example
extern "C" fn have_a_byte(b: libc::c_uchar); let a = Char::new('a').unwrap(); assert!(a.0 == 65); have_a_byte(a.to_glib()); let not_representable = Char::new('☔'); assert!(not_representable.is_none());
Trait Implementations
impl Debug for UChar[src]
impl Debug for UCharfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Copy for UChar[src]
impl Copy for UCharimpl Clone for UChar[src]
impl Clone for UCharfn clone(&self) -> UChar[src]
fn clone(&self) -> UCharReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Eq for UChar[src]
impl Eq for UCharimpl PartialEq for UChar[src]
impl PartialEq for UCharfn eq(&self, other: &UChar) -> bool[src]
fn eq(&self, other: &UChar) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &UChar) -> bool[src]
fn ne(&self, other: &UChar) -> boolThis method tests for !=.
impl From<UChar> for char[src]
impl From<UChar> for char