Struct UChar
pub struct UChar(pub u8);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());Tuple Fields§
§0: u8Trait Implementations§
impl Copy for UChar
impl Eq for UChar
impl StructuralPartialEq for UChar
Auto Trait Implementations§
impl Freeze for UChar
impl RefUnwindSafe for UChar
impl Send for UChar
impl Sync for UChar
impl Unpin for UChar
impl UnwindSafe for UChar
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more