[−][src]Struct glib::char::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]
pub fn new(c: char) -> Option<UChar>
[src]
Creates a Some(UChar)
if the given char
is representable as an libc::c_uchar
Example
ⓘThis example is not tested
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 Clone for UChar
[src]
impl Copy for UChar
[src]
impl Debug for UChar
[src]
impl Eq for UChar
[src]
impl From<UChar> for char
[src]
impl PartialEq<UChar> for UChar
[src]
impl StructuralEq for UChar
[src]
impl StructuralPartialEq for UChar
[src]
Auto Trait Implementations
impl RefUnwindSafe for UChar
impl Send for UChar
impl Sync for UChar
impl Unpin for UChar
impl UnwindSafe for UChar
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,