Skip to main content

TestAppContext

Struct TestAppContext 

Source
pub struct TestAppContext { /* private fields */ }
Expand description

The test version of App, passed to #[gpui::test] functions.

TestAppContext implements AppContext and adds helpers for windows, input, prompts and executors. Unlike TestApp, its methods don’t run pending tasks unless the method says so. Call TestAppContext::run_until_parked to run them. See the testing guide.

Create one directly with TestAppContext::single when you don’t need the macro.

Implementations§

Source§

impl TestAppContext

Source

pub fn build(dispatcher: TestDispatcher, fn_name: Option<&'static str>) -> Self

Creates a context that runs on dispatcher.

#[gpui::test] calls this for you.

Source

pub fn build_with_text_system( dispatcher: TestDispatcher, fn_name: Option<&'static str>, platform_text_system: Arc<dyn PlatformTextSystem>, ) -> Self

Creates a test context backed by the provided platform text system.

Source

pub fn disable_accessibility(&mut self)

Disables accessibility for subsequently created test windows.

Source

pub fn skip_drawing(&mut self)

Turns off drawing for this app for the rest of the test.

Source

pub fn single() -> Self

Creates a context with seed 0 that isn’t tied to a test function.

Use this in doctests and in code that runs outside #[gpui::test].

Source

pub fn test_function_name(&self) -> Option<&'static str>

Returns the name of the test function that created this context, if known.

Source

pub fn did_prompt_for_new_path(&self) -> bool

Returns whether a new-path prompt is waiting for TestAppContext::simulate_new_path_selection.

Source

pub fn active_idle_sleep_preventions(&self) -> usize

Returns the number of active idle sleep prevention tokens.

Source

pub fn set_idle_sleep_prevention_delay(&self, delay: Duration)

Sets the delay for subsequent idle sleep prevention acquisitions.

Source

pub fn set_idle_sleep_prevention_fails(&self, fails: bool)

Makes subsequent idle sleep prevention acquisitions fail or succeed.

Source

pub fn new_app(&self) -> TestAppContext

Creates another app that shares this context’s scheduler, so tasks from both apps interleave deterministically.

The new app has its own state, windows and globals.

Source

pub fn quit(&self)

Runs the cleanup registered with TestAppContext::on_quit, then shuts the app down.

#[gpui::test] calls this when the test ends.

Source

pub fn on_quit(&mut self, f: impl FnOnce() + 'static)

Registers f to run when the test ends, before the app shuts down.

Source

pub fn refresh(&mut self) -> Result<()>

Marks every window for redraw on the next effect cycle. Always returns Ok(()).

Source

pub fn executor(&self) -> BackgroundExecutor

Returns a clone of the background executor.

Source

pub fn foreground_executor(&self) -> &ForegroundExecutor

Returns the foreground executor.

Source

pub fn update<R>(&self, f: impl FnOnce(&mut App) -> R) -> R

Runs f with mutable access to the App.

Unlike TestApp::update, this doesn’t run pending tasks. Call TestAppContext::run_until_parked afterward if you need them.

§Example
let cx = TestAppContext::single();
let finished = Rc::new(Cell::new(false));

let flag = finished.clone();
cx.foreground_executor().spawn(async move { flag.set(true) }).detach();

cx.update(|_| ());
assert!(!finished.get(), "update doesn't run pending tasks");

cx.run_until_parked();
assert!(finished.get());
Source

pub fn read<R>(&self, f: impl FnOnce(&App) -> R) -> R

Runs f with read-only access to the App.

Source

pub fn add_window<F, V>(&mut self, build_window: F) -> WindowHandle<V>
where F: FnOnce(&mut Window, &mut Context<'_, V>) -> V, V: 'static + Render,

Opens a window with maximized bounds and returns its handle.

The window is backed by a test platform window, so input and resize helpers work on it. This doesn’t run pending tasks.

§Panics

Panics if the window can’t be opened.

Source

pub fn open_window<F, V>( &mut self, window_size: Size<Pixels>, build_window: F, ) -> WindowHandle<V>
where F: FnOnce(&mut Window, &mut Context<'_, V>) -> V, V: 'static + Render,

Opens a window of window_size at the origin and returns its handle.

Use this when a layout test needs a known size. TestAppContext::add_window uses the size of the test display instead. This doesn’t run pending tasks.

§Panics

Panics if the window can’t be opened.

Source

pub fn add_empty_window(&mut self) -> &mut VisualTestContext

Opens a window with an empty root view and returns a VisualTestContext for it.

Runs pending tasks before it returns.

Source

pub fn add_window_view<F, V>( &mut self, build_root_view: F, ) -> (Entity<V>, &mut VisualTestContext)
where F: FnOnce(&mut Window, &mut Context<'_, V>) -> V, V: 'static + Render,

Opens a window whose root view build_root_view builds.

Returns the root view’s entity and a VisualTestContext for the window. Use the returned context from then on, which is the usual pattern: let (view, cx) = cx.add_window_view(...);. Runs pending tasks before it returns. See testing a window for an example.

Source

pub fn text_system(&self) -> &Arc<TextSystem> ⓘ

Returns the text system.

Source

pub fn cursor_style(&self) -> CursorStyle

Returns the cursor most recently applied to the test platform.

Source

pub fn write_to_clipboard(&self, item: ClipboardItem)

Writes item to the test clipboard.

Source

pub fn read_from_clipboard(&self) -> Option<ClipboardItem>

Returns the item most recently written to the test clipboard, or None.

Source

pub fn simulate_new_path_selection( &self, select_path: impl FnOnce(&Path) -> Option<PathBuf>, )

Answers the oldest pending new-path prompt.

select_path receives the directory the app asked about and returns the chosen path, or None to cancel.

§Panics

Panics if no new-path prompt is pending.

Source

pub fn simulate_path_prompt_response( &self, select_paths: impl FnOnce(&PathPromptOptions) -> Option<Vec<PathBuf>>, )

Answers the oldest pending prompt_for_paths request.

select_paths receives the prompt’s options and returns the chosen paths, or None to cancel.

§Panics

Panics if no paths prompt is pending. Also panics if select_paths returns more than one path for a prompt that doesn’t allow multiple selection.

Source

pub fn did_prompt_for_paths(&self) -> bool

Returns whether a prompt_for_paths request is waiting for TestAppContext::simulate_path_prompt_response.

Source

pub fn simulate_prompt_answer(&self, button: &str)

Presses the button labelled button on the oldest pending prompt.

§Panics

Panics if no prompt is pending, or if no button on the prompt has the label button.

Source

pub fn has_pending_prompt(&self) -> bool

Returns whether a prompt is waiting for an answer.

Source

pub fn pending_prompt(&self) -> Option<(String, String)>

Returns the message and detail of the oldest pending prompt, or None.

The detail is an empty string when the prompt has none.

Source

pub fn opened_url(&self) -> Option<String>

Returns the URL most recently passed to open_url, or None.

Only the last URL is kept.

Source

pub fn app_identity(&self) -> Option<(SharedString, SharedString)>

Returns the identifier and name set with set_app_identity, or None if none was set.

Source

pub fn shown_system_notifications(&self) -> Vec<SystemNotification>

Returns every system notification shown during the test, in order.

A notification shown before the app has an identity is dropped and doesn’t appear here.

Source

pub fn delivered_system_notifications(&self) -> Vec<SystemNotification>

Returns the notifications that are shown and not yet dismissed.

A notification with the same tag as an earlier one replaces it.

Source

pub fn dismissed_system_notifications(&self) -> Vec<SharedString>

Returns the tags of the notifications dismissed during the test, in order.

Source

pub fn simulate_system_notification_response( &self, response: SystemNotificationResponse, )

Delivers response to the response handlers, as if the user had activated the notification.

Source

pub fn simulate_window_resize( &self, window_handle: AnyWindowHandle, size: Size<Pixels>, )

Resizes window_handle to size. See VisualTestContext::simulate_resize.

Source

pub fn simulate_window_visibility_change( &self, window_handle: AnyWindowHandle, visibility: WindowVisibility, )

Simulates a change in whether the platform is presenting the window.

Source

pub fn simulate_display_added( &self, display_id: DisplayId, refresh_interval: Option<Duration>, )

Simulates connecting a display.

Source

pub fn simulate_display_removed(&self, display_id: DisplayId)

Simulates disconnecting a display.

Source

pub fn simulate_display_refresh_interval_change( &self, display_id: DisplayId, refresh_interval: Option<Duration>, )

Simulates a connected display changing its refresh interval.

Source

pub fn simulate_window_visual_viewport_change( &self, window_handle: AnyWindowHandle, bounds: Bounds<Pixels>, )

Simulates visible viewport changes without resizing the window’s layout area.

Source

pub fn simulate_window_scale_factor_change( &self, window_handle: AnyWindowHandle, scale_factor: f32, )

Simulates the window moving to a display with a different scale factor.

Source

pub fn expect_restart(&self) -> Receiver<(Option<PathBuf>, Vec<OsString>)> ⓘ

Returns a receiver that gets the path and arguments of the next restart request.

The app doesn’t restart in a test. Calling this again replaces the previous sender, so the previous receiver is cancelled.

Source

pub fn set_screen_capture_sources(&self, sources: Vec<TestScreenCaptureSource>)

Sets the sources that screen capture queries return.

Source

pub fn windows(&self) -> Vec<AnyWindowHandle>

Returns the handles of all open windows.

Source

pub fn spawn<Fut, R>(&self, f: impl FnOnce(AsyncApp) -> Fut) -> Task<R> ⓘ
where Fut: Future<Output = R> + 'static, R: 'static,

Spawns a future on the foreground executor, with an AsyncApp for this app.

The future runs when tasks run, such as during TestAppContext::run_until_parked or a simulate_* method. A plain update doesn’t run it.

Source

pub fn has_global<G: Global>(&self) -> bool

Returns whether a global of type G is set.

Source

pub fn read_global<G: Global, R>(&self, read: impl FnOnce(&G, &App) -> R) -> R

Runs read with the global of type G.

§Panics

Panics if no global of type G is set. Use TestAppContext::try_read_global when it might not be.

Source

pub fn try_read_global<G: Global, R>( &self, read: impl FnOnce(&G, &App) -> R, ) -> Option<R>

Runs read with the global of type G if it is set, and returns None otherwise.

Source

pub fn set_global<G: Global>(&mut self, global: G)

Sets the global of type G, replacing any previous value.

Source

pub fn update_global<G: Global, R>( &mut self, update: impl FnOnce(&mut G, &mut App) -> R, ) -> R

Runs update with mutable access to the global of type G.

§Panics

Panics if no global of type G is set.

Source

pub fn to_async(&self) -> AsyncApp

Returns an AsyncApp for this app.

The handle holds a weak reference, so it can’t keep the app alive.

Source

pub fn run_until_parked(&self)

Runs pending tasks until none can make progress.

This doesn’t move the simulated clock. Use executor().advance_clock for that. Timers that haven’t expired stay pending.

Source

pub fn dispatch_action<A>(&mut self, window: AnyWindowHandle, action: A)
where A: Action,

Dispatches action to the focused element in window, then runs pending tasks.

§Panics

Panics if window has been closed.

Source

pub fn simulate_keystrokes(&mut self, window: AnyWindowHandle, keystrokes: &str)

Sends each keystroke in a space-separated list to window, then runs pending tasks.

Each part is parsed as in TestAppWindow::simulate_keystroke. The space bar is the key "space", which can’t appear in this list, because a space separates keystrokes. Two spaces in a row send an empty keystroke.

§Panics

Panics if any part isn’t a valid keystroke.

Source

pub fn simulate_input(&mut self, window: AnyWindowHandle, input: &str)

Types input into window by sending one keystroke per character, then runs pending tasks.

Each character is parsed as a keystroke, so the text reaches text inputs. A space is sent with the key " ", not "space".

Splitting on an empty string also sends an empty keystroke before the first character and after the last. Don’t rely on those.

Source

pub fn dispatch_keystroke( &mut self, window: AnyWindowHandle, keystroke: Keystroke, )

Dispatches one keystroke to the focused element in window.

This doesn’t run pending tasks. TestAppContext::simulate_keystrokes does.

Source

pub fn notifications<T: 'static>( &mut self, entity: &Entity<T>, ) -> impl Stream<Item = ()> + use<T>

Returns a stream that yields () each time entity notifies.

The stream ends when the entity is released.

Source

pub fn events<Evt, T: 'static + EventEmitter<Evt>>( &mut self, entity: &Entity<T>, ) -> UnboundedReceiver<Evt>
where Evt: 'static + Clone,

Returns a stream of the events entity emits, cloned, in order.

Source

pub async fn condition<T: 'static>( &mut self, entity: &Entity<T>, predicate: impl FnMut(&mut T, &mut Context<'_, T>) -> bool, )

Waits until predicate returns true for entity, checking after each notification.

§Panics

Panics if the predicate isn’t true within 3 seconds of simulated time, or if the entity is released while waiting.

Source

pub fn set_name(&mut self, name: &'static str)

Sets this app’s name.

Trait Implementations§

Source§

impl AppContext for TestAppContext

Source§

fn new<T: 'static>( &mut self, build_entity: impl FnOnce(&mut Context<'_, T>) -> T, ) -> Entity<T>

Creates an entity from build_entity, and returns a handle to it. Read more
Source§

fn reserve_entity<T: 'static>(&mut self) -> Reservation<T>

Reserves an entity slot, and returns a Reservation for it. Read more
Source§

fn insert_entity<T: 'static>( &mut self, reservation: Reservation<T>, build_entity: impl FnOnce(&mut Context<'_, T>) -> T, ) -> Entity<T>

Creates the entity for a Reservation from AppContext::reserve_entity. Read more
Source§

fn update_entity<T: 'static, R>( &mut self, handle: &Entity<T>, update: impl FnOnce(&mut T, &mut Context<'_, T>) -> R, ) -> R

Runs update with the entity and a Context for it, and returns the result. Read more
Source§

fn as_mut<'a, T>(&'a mut self, _: &Entity<T>) -> GpuiBorrow<'a, T>
where T: 'static,

Borrows the entity mutably, without a closure. Read more
Source§

fn read_entity<T, R>( &self, handle: &Entity<T>, read: impl FnOnce(&T, &App) -> R, ) -> R
where T: 'static,

Reads the entity with a shared borrow, and returns the result of read. Read more
Source§

fn notify(&mut self, entity_id: EntityId)

Tells GPUI that the entity with entity_id changed. Its observers run and windows that show it redraw. Read more
Source§

fn emit<EntityType, EventType>( &mut self, entity: &Entity<EntityType>, event: EventType, )
where EntityType: EventEmitter<EventType>, EventType: 'static,

Emits event from entity. Read more
Source§

fn update_window<T, F>(&mut self, window: AnyWindowHandle, f: F) -> Result<T>
where F: FnOnce(AnyView, &mut Window, &mut App) -> T,

Runs f with the window’s root view, the window and the app, and returns the result. Read more
Source§

fn with_window<R>( &mut self, entity_id: EntityId, f: impl FnOnce(&mut Window, &mut App) -> R, ) -> Option<R>

Runs f with the window that most recently rendered the entity entity_id, and returns the result. Read more
Source§

fn read_window<T, R>( &self, window: &WindowHandle<T>, read: impl FnOnce(Entity<T>, &App) -> R, ) -> Result<R>
where T: 'static,

Reads the root view of window with the app, and returns the result. Read more
Source§

fn background_spawn<R>( &self, future: impl Future<Output = R> + Send + 'static, ) -> Task<R> ⓘ
where R: Send + 'static,

Runs future on the background executor and returns a task for its result. Read more
Source§

fn read_global<G, R>(&self, callback: impl FnOnce(&G, &App) -> R) -> R
where G: Global,

Calls callback with the global of type G and the app, and returns the result. Read more
Source§

fn insert_global_entity<T: 'static>(&mut self, entity: Entity<T>)

Keeps entity alive without a handle to it. Read more
Source§

fn remove_global_entity<T: 'static>(&mut self, entity: &Entity<T>)

Stops keeping entity alive. It’s dropped once no other handle refers to it.
Source§

fn global_entities<T: 'static>(&self) -> impl Iterator<Item = Entity<T>>

Returns the entities stored with AppContext::insert_global_entity whose type is T.
Source§

impl Clone for TestAppContext

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where 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) -> D
where M: TransformMatrix<T>,

👎Deprecated since 0.7.7:

replaced by palette::chromatic_adaptation::AdaptIntoUnclamped

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

👎Deprecated since 0.7.7:

replaced by palette::chromatic_adaptation::AdaptIntoUnclamped

Convert the source color to the destination color using the bradford method by default.
Source§

impl<T, C> AdaptIntoUnclamped<T> for C
where T: AdaptFromUnclamped<C>,

Source§

type Scalar = <T as AdaptFromUnclamped<C>>::Scalar

The number type that’s used as the color’s components.
Source§

fn adapt_into_unclamped_with<M>(self) -> T

Adapt a color of type Self into a color of type T, using the custom matrix M. Read more
Source§

fn adapt_into_unclamped(self) -> T
where Bradford: LmsToXyz<Self::Scalar> + XyzToLms<Self::Scalar>,

Adapt a color of type Self into a color of type T, using the Bradford matrix. Read more
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<T, C> ComponentsInto<C> for T

Source§

fn components_into(self) -> C

Cast this collection of color components into a collection of colors. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more