pub struct AsyncWindowContext { /* private fields */ }Expand description
A handle to the app and one window, for use across .await points.
Get one from Context::spawn_in or Window::spawn. It derefs to
AsyncApp, so the methods of AsyncApp are available on it too. The window
methods on this type return an error once the window has closed.
Use it inside a future when you need the window and not only the app. See contexts.
§Examples
use gpui::{Context, Render, TestApp, Window, div, prelude::*};
struct Panel {
updates: usize,
}
impl Render for Panel {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div()
}
}
let mut app = TestApp::new();
let mut window = app.open_window(|_window, _cx| Panel { updates: 0 });
window.update(|panel, window, cx| {
cx.spawn_in(window, async move |panel, cx| {
panel
.update(cx, |panel, cx| {
panel.updates += 1;
cx.notify();
})
.ok();
})
.detach();
});
app.run_until_parked();
window.read(|panel, _cx| assert_eq!(panel.updates, 1));Implementations§
Source§impl AsyncWindowContext
impl AsyncWindowContext
Sourcepub fn window_handle(&self) -> AnyWindowHandle
pub fn window_handle(&self) -> AnyWindowHandle
Returns the handle of the window this context is for.
Sourcepub fn update<R>(
&mut self,
update: impl FnOnce(&mut Window, &mut App) -> R,
) -> Result<R>
pub fn update<R>( &mut self, update: impl FnOnce(&mut Window, &mut App) -> R, ) -> Result<R>
Runs update with the window and the app, and returns its result.
Effects queued by update are flushed before this returns.
§Errors
Returns an error if the window has closed, or if the app is quitting or already borrowed.
Sourcepub fn update_root<R>(
&mut self,
update: impl FnOnce(AnyView, &mut Window, &mut App) -> R,
) -> Result<R>
pub fn update_root<R>( &mut self, update: impl FnOnce(AnyView, &mut Window, &mut App) -> R, ) -> Result<R>
Like AsyncWindowContext::update, but also passes the window’s root view.
§Errors
Returns an error under the same conditions as AsyncWindowContext::update.
Sourcepub fn on_next_frame(&mut self, f: impl FnOnce(&mut Window, &mut App) + 'static)
pub fn on_next_frame(&mut self, f: impl FnOnce(&mut Window, &mut App) + 'static)
Runs f before the window draws its next frame. Does nothing if the window has
closed.
Schedules the callback like Window::on_next_frame, but tolerates a window that has
already been closed.
Sourcepub fn read_global<G: Global, R>(
&mut self,
read: impl FnOnce(&G, &Window, &App) -> R,
) -> Result<R>
pub fn read_global<G: Global, R>( &mut self, read: impl FnOnce(&G, &Window, &App) -> R, ) -> Result<R>
Sourcepub fn update_global<G, R>(
&mut self,
update: impl FnOnce(&mut G, &mut Window, &mut App) -> R,
) -> Result<R>where
G: Global,
pub fn update_global<G, R>(
&mut self,
update: impl FnOnce(&mut G, &mut Window, &mut App) -> R,
) -> Result<R>where
G: Global,
Updates the global of type G with update, and returns its result.
The global is taken out of the app while update runs, as with
AsyncApp::update_global.
§Errors
Returns an error if the window has closed.
§Panics
Panics if no global of type G has been set.
Sourcepub fn spawn<AsyncFn, R>(&self, f: AsyncFn) -> Task<R> ⓘwhere
AsyncFn: AsyncFnOnce(&mut AsyncWindowContext) -> R + 'static,
R: 'static,
pub fn spawn<AsyncFn, R>(&self, f: AsyncFn) -> Task<R> ⓘwhere
AsyncFn: AsyncFnOnce(&mut AsyncWindowContext) -> R + 'static,
R: 'static,
Runs the future returned by f on the main thread, with an
AsyncWindowContext for this window, and returns a task for its result.
Dropping the returned Task cancels the future. Store it, await it or call
Task::detach.
Sourcepub fn prompt<T>(
&mut self,
level: PromptLevel,
message: &str,
detail: Option<&str>,
answers: &[T],
) -> Receiver<usize> ⓘ
pub fn prompt<T>( &mut self, level: PromptLevel, message: &str, detail: Option<&str>, answers: &[T], ) -> Receiver<usize> ⓘ
Shows a platform alert with one button for each entry in answers.
The receiver resolves to the index of the button the user clicked. If the window
has closed, the receiver is canceled, so awaiting it returns an error. See
Window::prompt for level and detail.
Methods from Deref<Target = AsyncApp>§
Sourcepub fn refresh(&self)
pub fn refresh(&self)
Schedules a redraw of every window.
The windows draw on the next frame. This doesn’t draw anything itself.
Sourcepub fn background_executor(&self) -> &BackgroundExecutor
pub fn background_executor(&self) -> &BackgroundExecutor
Returns the BackgroundExecutor, for running work on other threads.
Sourcepub fn is_test(&self) -> bool
pub fn is_test(&self) -> bool
Whether this app runs on the deterministic test scheduler. See
BackgroundExecutor::is_test.
Sourcepub fn foreground_executor(&self) -> &ForegroundExecutor
pub fn foreground_executor(&self) -> &ForegroundExecutor
Returns the ForegroundExecutor, for running futures on the main thread.
Sourcepub fn update<R>(&self, f: impl FnOnce(&mut App) -> R) -> R
pub fn update<R>(&self, f: impl FnOnce(&mut App) -> R) -> R
Runs f with the app and returns its result.
Effects queued by f, such as notifications, are flushed before this returns.
§Panics
Panics if the app has been released, or if it is already borrowed, such as when called from inside another update.
Sourcepub fn subscribe<T, Event>(
&mut self,
entity: &Entity<T>,
on_event: impl FnMut(Entity<T>, &Event, &mut App) + 'static,
) -> Subscriptionwhere
T: 'static + EventEmitter<Event>,
Event: 'static,
pub fn subscribe<T, Event>(
&mut self,
entity: &Entity<T>,
on_event: impl FnMut(Entity<T>, &Event, &mut App) + 'static,
) -> Subscriptionwhere
T: 'static + EventEmitter<Event>,
Event: 'static,
Calls on_event each time entity emits an Event.
The callback receives the emitting entity, the event and the app. The
subscription stays active while you hold it. Dropping it unsubscribes, and
Subscription::detach keeps the subscription for as long as the entity lives.
Inside an entity’s own context, Context::subscribe is the usual choice.
Sourcepub fn open_window<V>(
&self,
options: WindowOptions,
build_root_view: impl FnOnce(&mut Window, &mut App) -> Entity<V>,
) -> Result<WindowHandle<V>>where
V: 'static + Render,
pub fn open_window<V>(
&self,
options: WindowOptions,
build_root_view: impl FnOnce(&mut Window, &mut App) -> Entity<V>,
) -> Result<WindowHandle<V>>where
V: 'static + Render,
Opens a window with options and returns a handle to it.
build_root_view creates the window’s root view. The method returns an error if the app is
quitting.
§Panics
Panics if the app has been released, or if it is already borrowed.
Sourcepub fn spawn<AsyncFn, R>(&self, f: AsyncFn) -> Task<R> ⓘwhere
AsyncFn: AsyncFnOnce(&mut AsyncApp) -> R + 'static,
R: 'static,
pub fn spawn<AsyncFn, R>(&self, f: AsyncFn) -> Task<R> ⓘwhere
AsyncFn: AsyncFnOnce(&mut AsyncApp) -> R + 'static,
R: 'static,
Runs the future returned by f on the main thread, and returns a task for its
result.
f receives an &mut AsyncApp. Dropping the returned Task cancels the
future, so store it, await it or call Task::detach.
Sourcepub fn has_global<G: Global>(&self) -> bool
pub fn has_global<G: Global>(&self) -> bool
Returns whether a global of type G has been set.
Sourcepub fn read_global<G: Global, R>(&self, read: impl FnOnce(&G, &App) -> R) -> R
pub fn read_global<G: Global, R>(&self, read: impl FnOnce(&G, &App) -> R) -> R
Calls read with the global of type G and the app, and returns its result.
Use AsyncApp::try_read_global if the global may not be set.
§Panics
Panics if no global of type G has been set, or if the app has been released.
Sourcepub fn try_read_global<G: Global, R>(
&self,
read: impl FnOnce(&G, &App) -> R,
) -> Option<R>
pub fn try_read_global<G: Global, R>( &self, read: impl FnOnce(&G, &App) -> R, ) -> Option<R>
Like AsyncApp::read_global, but returns None instead of panicking when no
global of type G is set, or when the app is quitting.
Sourcepub fn read_default_global<G: Global + Default, R>(
&self,
read: impl FnOnce(&G, &App) -> R,
) -> R
pub fn read_default_global<G: Global + Default, R>( &self, read: impl FnOnce(&G, &App) -> R, ) -> R
Like AsyncApp::read_global, but first sets a G::default() if no global of
type G has been set.
Sourcepub fn update_global<G: Global, R>(
&self,
update: impl FnOnce(&mut G, &mut App) -> R,
) -> R
pub fn update_global<G: Global, R>( &self, update: impl FnOnce(&mut G, &mut App) -> R, ) -> R
Updates the global of type G with update, and returns its result.
While update runs, the global is taken out of the app. Reading it through the
app from inside update panics, so change the global through the &mut G that
update receives.
§Panics
Panics if no global of type G has been set, or if the app has been released.
Sourcepub fn on_drop<T: 'static, Callback: FnOnce(&mut T, &mut Context<'_, T>) + 'static>(
&self,
entity: &WeakEntity<T>,
f: Callback,
) -> Deferred<impl FnOnce() + use<T, Callback>>
pub fn on_drop<T: 'static, Callback: FnOnce(&mut T, &mut Context<'_, T>) + 'static>( &self, entity: &WeakEntity<T>, f: Callback, ) -> Deferred<impl FnOnce() + use<T, Callback>>
Returns a guard that calls f with entity when the guard is dropped.
f doesn’t run if the entity has been released by then. Hold the guard in a
variable. A guard that is dropped at once runs f immediately.
§Examples
use gpui::{AppContext, TestApp};
let mut app = TestApp::new();
let log = app.update(|cx| cx.new(|_| Vec::<&'static str>::new()));
let guard = app.update(|cx| {
cx.to_async().on_drop(&log.downgrade(), |log, cx| {
log.push("finished");
cx.notify();
})
});
drop(guard);
app.read(|cx| assert_eq!(*log.read(cx), vec!["finished"]));Trait Implementations§
Source§impl AppContext for AsyncWindowContext
impl AppContext for AsyncWindowContext
Source§fn new<T>(
&mut self,
build_entity: impl FnOnce(&mut Context<'_, T>) -> T,
) -> Entity<T>where
T: 'static,
fn new<T>(
&mut self,
build_entity: impl FnOnce(&mut Context<'_, T>) -> T,
) -> Entity<T>where
T: 'static,
build_entity, and returns a handle to it. Read moreSource§fn reserve_entity<T: 'static>(&mut self) -> Reservation<T>
fn reserve_entity<T: 'static>(&mut self) -> Reservation<T>
Reservation for it. Read moreSource§fn insert_entity<T: 'static>(
&mut self,
reservation: Reservation<T>,
build_entity: impl FnOnce(&mut Context<'_, T>) -> T,
) -> Entity<T>
fn insert_entity<T: 'static>( &mut self, reservation: Reservation<T>, build_entity: impl FnOnce(&mut Context<'_, T>) -> T, ) -> Entity<T>
Source§fn update_entity<T: 'static, R>(
&mut self,
handle: &Entity<T>,
update: impl FnOnce(&mut T, &mut Context<'_, T>) -> R,
) -> R
fn update_entity<T: 'static, R>( &mut self, handle: &Entity<T>, update: impl FnOnce(&mut T, &mut Context<'_, T>) -> R, ) -> R
Source§fn as_mut<'a, T>(&'a mut self, _: &Entity<T>) -> GpuiBorrow<'a, T>where
T: 'static,
fn as_mut<'a, T>(&'a mut self, _: &Entity<T>) -> GpuiBorrow<'a, T>where
T: 'static,
Source§fn read_entity<T, R>(
&self,
handle: &Entity<T>,
read: impl FnOnce(&T, &App) -> R,
) -> Rwhere
T: 'static,
fn read_entity<T, R>(
&self,
handle: &Entity<T>,
read: impl FnOnce(&T, &App) -> R,
) -> Rwhere
T: 'static,
read. Read moreSource§fn notify(&mut self, entity_id: EntityId)
fn notify(&mut self, entity_id: EntityId)
entity_id changed. Its observers run and windows
that show it redraw. Read moreSource§fn emit<EntityType, EventType>(
&mut self,
entity: &Entity<EntityType>,
event: EventType,
)where
EntityType: EventEmitter<EventType>,
EventType: 'static,
fn emit<EntityType, EventType>(
&mut self,
entity: &Entity<EntityType>,
event: EventType,
)where
EntityType: EventEmitter<EventType>,
EventType: 'static,
Source§fn update_window<T, F>(
&mut self,
window: AnyWindowHandle,
update: F,
) -> Result<T>
fn update_window<T, F>( &mut self, window: AnyWindowHandle, update: F, ) -> Result<T>
f with the window’s root view, the window and the app, and returns the
result. Read moreSource§fn with_window<R>(
&mut self,
entity_id: EntityId,
f: impl FnOnce(&mut Window, &mut App) -> R,
) -> Option<R>
fn with_window<R>( &mut self, entity_id: EntityId, f: impl FnOnce(&mut Window, &mut App) -> R, ) -> Option<R>
f with the window that most recently rendered the entity entity_id, and
returns the result. Read moreSource§fn read_window<T, R>(
&self,
window: &WindowHandle<T>,
read: impl FnOnce(Entity<T>, &App) -> R,
) -> Result<R>where
T: 'static,
fn read_window<T, R>(
&self,
window: &WindowHandle<T>,
read: impl FnOnce(Entity<T>, &App) -> R,
) -> Result<R>where
T: 'static,
window with the app, and returns the result. Read moreSource§fn background_spawn<R>(
&self,
future: impl Future<Output = R> + Send + 'static,
) -> Task<R> ⓘwhere
R: Send + 'static,
fn background_spawn<R>(
&self,
future: impl Future<Output = R> + Send + 'static,
) -> Task<R> ⓘwhere
R: Send + 'static,
future on the background executor and returns a task for its result. Read moreSource§fn insert_global_entity<T: 'static>(&mut self, entity: Entity<T>)
fn insert_global_entity<T: 'static>(&mut self, entity: Entity<T>)
entity alive without a handle to it. Read moreSource§fn remove_global_entity<T: 'static>(&mut self, entity: &Entity<T>)
fn remove_global_entity<T: 'static>(&mut self, entity: &Entity<T>)
entity alive. It’s dropped once no other handle refers to it.Source§fn global_entities<T: 'static>(&self) -> impl Iterator<Item = Entity<T>>
fn global_entities<T: 'static>(&self) -> impl Iterator<Item = Entity<T>>
AppContext::insert_global_entity whose type is
T.Source§impl Clone for AsyncWindowContext
impl Clone for AsyncWindowContext
Source§impl Deref for AsyncWindowContext
impl Deref for AsyncWindowContext
Source§impl DerefMut for AsyncWindowContext
impl DerefMut for AsyncWindowContext
Source§impl VisualContext for AsyncWindowContext
impl VisualContext for AsyncWindowContext
Source§fn window_handle(&self) -> AnyWindowHandle
fn window_handle(&self) -> AnyWindowHandle
Source§fn new_window_entity<T: 'static>(
&mut self,
build_entity: impl FnOnce(&mut Window, &mut Context<'_, T>) -> T,
) -> Result<Entity<T>>
fn new_window_entity<T: 'static>( &mut self, build_entity: impl FnOnce(&mut Window, &mut Context<'_, T>) -> T, ) -> Result<Entity<T>>
Source§fn update_window_entity<T: 'static, R>(
&mut self,
view: &Entity<T>,
update: impl FnOnce(&mut T, &mut Window, &mut Context<'_, T>) -> R,
) -> Result<R>
fn update_window_entity<T: 'static, R>( &mut self, view: &Entity<T>, update: impl FnOnce(&mut T, &mut Window, &mut Context<'_, T>) -> R, ) -> Result<R>
update with the entity, its window and a Context for the entity, and
returns the result, wrapped in VisualContext::Result.Auto Trait Implementations§
impl !RefUnwindSafe for AsyncWindowContext
impl !Send for AsyncWindowContext
impl !Sync for AsyncWindowContext
impl !UnwindSafe for AsyncWindowContext
impl Freeze for AsyncWindowContext
impl Unpin for AsyncWindowContext
impl UnsafeUnpin for AsyncWindowContext
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>,
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,
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
Source§impl<T, C> ComponentsInto<C> for T
impl<T, C> ComponentsInto<C> for T
Source§fn components_into(self) -> C
fn components_into(self) -> C
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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.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.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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