Enum ROption
#[repr(u8)]pub enum ROption<T> {
RSome(T),
RNone,
}Expand description
Ffi-safe equivalent of the std::option::Option type.
Option is also ffi-safe for NonNull/NonZero types, and references.
Variants§
Implementations§
§impl<T> ROption<T>
impl<T> ROption<T>
pub const fn as_ref(&self) -> ROption<&T>
pub const fn as_ref(&self) -> ROption<&T>
Converts from ROption<T> to ROption<&T>.
§Example
assert_eq!(RSome(10).as_ref(), RSome(&10));
assert_eq!(RNone::<u32>.as_ref(), RNone);
pub fn as_mut(&mut self) -> ROption<&mut T>
pub fn as_mut(&mut self) -> ROption<&mut T>
Converts from ROption<T> to ROption<&mut T>.
§Example
assert_eq!(RSome(10).as_mut(), RSome(&mut 10));
assert_eq!(RNone::<u32>.as_mut(), RNone);
pub const fn is_rsome(&self) -> bool
pub const fn is_rsome(&self) -> bool
Returns whether self is an RSome
§Example
assert_eq!(RSome(10).is_rsome(), true);
assert_eq!(RNone::<u32>.is_rsome(), false);
pub const fn is_rnone(&self) -> bool
pub const fn is_rnone(&self) -> bool
Returns whether self is an RNone
§Example
assert_eq!(RSome(10).is_rnone(), false);
assert_eq!(RNone::<u32>.is_rnone(), true);
pub const fn is_some(&self) -> bool
pub const fn is_some(&self) -> bool
Returns whether self is an RSome
§Example
assert_eq!(RSome(10).is_some(), true);
assert_eq!(RNone::<u32>.is_some(), false);
pub const fn is_none(&self) -> bool
pub const fn is_none(&self) -> bool
Returns whether self is an RNone
§Example
assert_eq!(RSome(10).is_none(), false);
assert_eq!(RNone::<u32>.is_none(), true);
pub fn into_option(self) -> Option<T>
pub fn into_option(self) -> Option<T>
Converts from ROption<T> to Option<T>.
§Example
assert_eq!(RSome(10).into_option(), Some(10));
assert_eq!(RNone::<u32>.into_option(), None);
pub fn unwrap(self) -> T
pub fn unwrap(self) -> T
pub fn unwrap_or(self, def: T) -> T
pub fn unwrap_or(self, def: T) -> T
Returns the value in the ROption<T>, or def if self is RNone.
§Example
assert_eq!(RSome(10).unwrap_or(99), 10);
assert_eq!(RNone::<u32>.unwrap_or(99), 99);
pub fn unwrap_or_default(self) -> Twhere
T: Default,
pub fn unwrap_or_default(self) -> Twhere
T: Default,
Returns the value in the ROption<T>, or T::default() if self is RNone.
§Example
assert_eq!(RSome(10).unwrap_or_default(), 10);
assert_eq!(RNone::<u32>.unwrap_or_default(), 0);
pub fn unwrap_or_else<F>(self, f: F) -> Twhere
F: FnOnce() -> T,
pub fn unwrap_or_else<F>(self, f: F) -> Twhere
F: FnOnce() -> T,
Returns the value in the ROption<T>,
or the return value of calling f if self is RNone.
§Example
assert_eq!(RSome(10).unwrap_or_else(|| 77), 10);
assert_eq!(RNone::<u32>.unwrap_or_else(|| 77), 77);
pub fn map<U, F>(self, f: F) -> ROption<U>where
F: FnOnce(T) -> U,
pub fn map<U, F>(self, f: F) -> ROption<U>where
F: FnOnce(T) -> U,
Converts the ROption<T> to a ROption<U>,
transforming the contained value with the f closure.
§Example
assert_eq!(RSome(10).map(|x| x * 2), RSome(20));
assert_eq!(RNone::<u32>.map(|x| x * 2), RNone);
pub fn map_or<U, F>(self, default: U, f: F) -> Uwhere
F: FnOnce(T) -> U,
pub fn map_or<U, F>(self, default: U, f: F) -> Uwhere
F: FnOnce(T) -> U,
Transforms (and returns) the contained value with the f closure,
or returns default if self is RNone.
§Example
assert_eq!(RSome(10).map_or(77, |x| x * 2), 20);
assert_eq!(RNone::<u32>.map_or(77, |x| x * 2), 77);
pub fn map_or_else<U, D, F>(self, otherwise: D, f: F) -> U
pub fn map_or_else<U, D, F>(self, otherwise: D, f: F) -> U
Transforms (and returns) the contained value with the f closure,
or returns otherwise() if self is RNone..
§Example
assert_eq!(RSome(10).map_or_else(|| 77, |x| x * 2), 20);
assert_eq!(RNone::<u32>.map_or_else(|| 77, |x| x * 2), 77);
pub fn ok_or<E>(self, err: E) -> RResult<T, E>
pub fn ok_or<E>(self, err: E) -> RResult<T, E>
Transforms the ROption<T> into a RResult<T, E>, mapping RSome(v)
to ROk(v) and RNone to RErr(err).
Arguments passed to ok_or are eagerly evaluated; if you are passing the
result of a function call, it is recommended to use ok_or_else, which is
lazily evaluated.
§Examples
let x = RSome("foo");
assert_eq!(x.ok_or(0), ROk("foo"));
let x: ROption<&str> = RNone;
assert_eq!(x.ok_or(0), RErr(0));pub fn ok_or_else<E, F>(self, err: F) -> RResult<T, E>where
F: FnOnce() -> E,
pub fn ok_or_else<E, F>(self, err: F) -> RResult<T, E>where
F: FnOnce() -> E,
Transforms the ROption<T> into a RResult<T, E>, mapping RSome(v) to
ROk(v) and RNone to RErr(err()).
§Examples
let x = RSome("foo");
assert_eq!(x.ok_or_else(|| 0), ROk("foo"));
let x: ROption<&str> = RNone;
assert_eq!(x.ok_or_else(|| 0), RErr(0));pub fn filter<P>(self, predicate: P) -> ROption<T>
pub fn filter<P>(self, predicate: P) -> ROption<T>
Returns self if predicate(&self) is true, otherwise returns RNone.
§Example
assert_eq!(RSome(10).filter(|x| (x % 2) == 0), RSome(10));
assert_eq!(RSome(10).filter(|x| (x % 2) == 1), RNone);
assert_eq!(RNone::<u32>.filter(|_| true), RNone);
assert_eq!(RNone::<u32>.filter(|_| false), RNone);
pub fn and(self, optb: ROption<T>) -> ROption<T>
pub fn and(self, optb: ROption<T>) -> ROption<T>
Returns self if it is RNone, otherwise returns optb.
§Example
assert_eq!(RSome(10).and(RSome(20)), RSome(20));
assert_eq!(RSome(10).and(RNone), RNone);
assert_eq!(RNone::<u32>.and(RSome(20)), RNone);
assert_eq!(RNone::<u32>.and(RNone), RNone);
pub fn and_then<F, U>(self, f: F) -> ROption<U>
pub fn and_then<F, U>(self, f: F) -> ROption<U>
Returns self if it is RNone,
otherwise returns the result of calling f with the value in RSome.
§Example
assert_eq!(RSome(10).and_then(|x| RSome(x * 2)), RSome(20));
assert_eq!(RSome(10).and_then(|_| RNone::<u32>), RNone);
assert_eq!(RNone::<u32>.and_then(|x| RSome(x * 2)), RNone);
assert_eq!(RNone::<u32>.and_then(|_| RNone::<u32>), RNone);
pub fn or(self, optb: ROption<T>) -> ROption<T>
pub fn or(self, optb: ROption<T>) -> ROption<T>
Returns self if it contains a value, otherwise returns optb.
§Example
assert_eq!(RSome(10).or(RSome(20)), RSome(10));
assert_eq!(RSome(10).or(RNone ), RSome(10));
assert_eq!(RNone::<u32>.or(RSome(20)), RSome(20));
assert_eq!(RNone::<u32>.or(RNone ), RNone);
pub fn or_else<F>(self, f: F) -> ROption<T>
pub fn or_else<F>(self, f: F) -> ROption<T>
Returns self if it contains a value,
otherwise calls optb and returns the value it evaluates to.
§Example
assert_eq!(RSome(10).or_else(|| RSome(20)), RSome(10));
assert_eq!(RSome(10).or_else(|| RNone), RSome(10));
assert_eq!(RNone::<u32>.or_else(|| RSome(20)), RSome(20));
assert_eq!(RNone::<u32>.or_else(|| RNone), RNone);
pub fn xor(self, optb: ROption<T>) -> ROption<T>
pub fn xor(self, optb: ROption<T>) -> ROption<T>
Returns RNone if both values are RNone or RSome,
otherwise returns the value that is anRSome.
§Example
assert_eq!(RSome(10).xor(RSome(20)), RNone);
assert_eq!(RSome(10).xor(RNone), RSome(10));
assert_eq!(RNone::<u32>.xor(RSome(20)), RSome(20));
assert_eq!(RNone::<u32>.xor(RNone), RNone);
pub fn get_or_insert(&mut self, value: T) -> &mut T
pub fn get_or_insert(&mut self, value: T) -> &mut T
Sets this ROption to RSome(value) if it was RNone.
Returns a mutable reference to the inserted/pre-existing RSome.
§Example
assert_eq!(RSome(10).get_or_insert(40), &mut 10);
assert_eq!(RSome(20).get_or_insert(55), &mut 20);
assert_eq!(RNone::<u32>.get_or_insert(77), &mut 77);
pub fn get_or_insert_with<F>(&mut self, func: F) -> &mut Twhere
F: FnOnce() -> T,
pub fn get_or_insert_with<F>(&mut self, func: F) -> &mut Twhere
F: FnOnce() -> T,
Sets this ROption to RSome(func()) if it was RNone.
Returns a mutable reference to the inserted/pre-existing RSome.
§Example
assert_eq!(RSome(10).get_or_insert_with(|| 40), &mut 10);
assert_eq!(RSome(20).get_or_insert_with(|| 55), &mut 20);
assert_eq!(RNone::<u32>.get_or_insert_with(|| 77), &mut 77);
pub fn take(&mut self) -> ROption<T>
pub fn take(&mut self) -> ROption<T>
Takes the value of self, replacing it with RNone
§Example
let mut opt0 = RSome(10);
assert_eq!(opt0.take(), RSome(10));
assert_eq!(opt0, RNone);
let mut opt1 = RSome(20);
assert_eq!(opt1.take(), RSome(20));
assert_eq!(opt1, RNone);
let mut opt2 = RNone::<u32>;
assert_eq!(opt2.take(), RNone);
assert_eq!(opt2, RNone);
pub fn replace(&mut self, value: T) -> ROption<T>
pub fn replace(&mut self, value: T) -> ROption<T>
Replaces the value of self with RSome(value).
§Example
let mut opt0 = RSome(10);
assert_eq!(opt0.replace(55), RSome(10));
assert_eq!(opt0, RSome(55));
let mut opt1 = RSome(20);
assert_eq!(opt1.replace(88), RSome(20));
assert_eq!(opt1, RSome(88));
let mut opt2 = RNone::<u32>;
assert_eq!(opt2.replace(33), RNone);
assert_eq!(opt2, RSome(33));
§impl<T> ROption<&T>
impl<T> ROption<&T>
§impl<T> ROption<&mut T>
impl<T> ROption<&mut T>
§impl<T> ROption<T>where
T: Deref,
impl<T> ROption<T>where
T: Deref,
pub fn as_deref(&self) -> ROption<&<T as Deref>::Target>
pub fn as_deref(&self) -> ROption<&<T as Deref>::Target>
Converts from ROption<T> (or &ROption<T>) to ROption<&T::Target>.
Leaves the original ROption in-place, creating a new one with a
reference to the original one, additionally coercing the contents via
Deref.
§Examples
let x: ROption<RString> = RSome(RString::from("hey"));
assert_eq!(x.as_deref(), RSome("hey"));
let x: ROption<RString> = RNone;
assert_eq!(x.as_deref(), RNone);Trait Implementations§
impl<T> Copy for ROption<T>where
T: Copy,
§impl<'de, T> Deserialize<'de> for ROption<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for ROption<T>where
T: Deserialize<'de>,
§fn deserialize<D>(
deserializer: D,
) -> Result<ROption<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ROption<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl<T> Eq for ROption<T>where
T: Eq,
§impl<T> GetStaticEquivalent_ for ROption<T>where
T: StableAbi,
impl<T> GetStaticEquivalent_ for ROption<T>where
T: StableAbi,
§type StaticEquivalent = _static_ROption<<T as GetStaticEquivalent_>::StaticEquivalent>
type StaticEquivalent = _static_ROption<<T as GetStaticEquivalent_>::StaticEquivalent>
'static equivalent of Self§impl<T> Ord for ROption<T>where
T: Ord,
impl<T> Ord for ROption<T>where
T: Ord,
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl<T> PartialOrd for ROption<T>where
T: PartialOrd,
impl<T> PartialOrd for ROption<T>where
T: PartialOrd,
§impl<T> Serialize for ROption<T>where
T: Serialize,
impl<T> Serialize for ROption<T>where
T: Serialize,
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
§impl<T> StableAbi for ROption<T>where
T: StableAbi,
impl<T> StableAbi for ROption<T>where
T: StableAbi,
§type IsNonZeroType = False
type IsNonZeroType = False
§const ABI_CONSTS: AbiConsts = _
const ABI_CONSTS: AbiConsts = _
const-equivalents of the associated types.impl<T> StructuralPartialEq for ROption<T>where
T: PartialEq,
Auto Trait Implementations§
impl<T> Freeze for ROption<T>where
T: Freeze,
impl<T> RefUnwindSafe for ROption<T>where
T: RefUnwindSafe,
impl<T> Send for ROption<T>where
T: Send,
impl<T> Sync for ROption<T>where
T: Sync,
impl<T> Unpin for ROption<T>where
T: Unpin,
impl<T> UnsafeUnpin for ROption<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ROption<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
Source§type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
Source§fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
§impl<T> AlignerFor<1> for T
impl<T> AlignerFor<1> for T
§impl<T> AlignerFor<2> for T
impl<T> AlignerFor<2> for T
§impl<T> AlignerFor<4> for T
impl<T> AlignerFor<4> for T
§impl<T> AlignerFor<8> for T
impl<T> AlignerFor<8> for T
§impl<T> AlignerFor<16> for T
impl<T> AlignerFor<16> for T
§impl<T> AlignerFor<32> for T
impl<T> AlignerFor<32> for T
§impl<T> AlignerFor<64> for T
impl<T> AlignerFor<64> for T
§impl<T> AlignerFor<128> for T
impl<T> AlignerFor<128> for T
§impl<T> AlignerFor<256> for T
impl<T> AlignerFor<256> for T
§impl<T> AlignerFor<512> for T
impl<T> AlignerFor<512> for T
§impl<T> AlignerFor<1024> for T
impl<T> AlignerFor<1024> for T
§impl<T> AlignerFor<2048> for T
impl<T> AlignerFor<2048> for T
§impl<T> AlignerFor<4096> for T
impl<T> AlignerFor<4096> for T
§impl<T> AlignerFor<8192> for T
impl<T> AlignerFor<8192> for T
§impl<T> AlignerFor<16384> for T
impl<T> AlignerFor<16384> for T
§impl<T> AlignerFor<32768> for T
impl<T> AlignerFor<32768> for T
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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
§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
§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
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
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§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, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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> ⓘ
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> ⓘ
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 moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.impl<T> MaybeClone for T
impl<T> MaybeDebug for Twhere
T: Debug,
impl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSync for Twhere
T: Sync,
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
§impl<S> ROExtAcc for S
impl<S> ROExtAcc for S
§fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
offset. Read more§fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
offset. Read more§fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
offset. Read more§fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
offset. Read more§impl<S> ROExtOps<Aligned> for S
impl<S> ROExtOps<Aligned> for S
§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read more§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
§impl<S> ROExtOps<Unaligned> for S
impl<S> ROExtOps<Unaligned> for S
§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read more§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
piped except that the function takes &Self
Useful for functions that take &Self instead of Self. Read more§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
piped, except that the function takes &mut Self.
Useful for functions that take &mut Self instead of Self.§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
AsRef,
using the turbofish .as_ref_::<_>() syntax. Read more§impl<This> TransmuteElement for Thiswhere
This: ?Sized,
impl<This> TransmuteElement for Thiswhere
This: ?Sized,
§unsafe fn transmute_element<T>(self) -> Self::TransmutedPtrwhere
Self: CanTransmuteElement<T>,
unsafe fn transmute_element<T>(self) -> Self::TransmutedPtrwhere
Self: CanTransmuteElement<T>,
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more