Skip to main content

Entity

Struct Entity 

Source
pub struct Entity<T> { /* private fields */ }
Expand description

A handle to state owned by the App.

An Entity<T> keeps its value alive while any handle to it exists. Read the value with Entity::read, change it with Entity::update, and call Entity::downgrade for a WeakEntity that doesn’t keep it alive.

Cloning is cheap. The clone is another handle to the same value, and two handles compare equal when they refer to the same entity.

When the last strong handle is dropped, GPUI releases the value at the end of the current update. See ownership and data flow for the model.

§Examples

struct Counter {
    count: usize,
}

let counter: Entity<Counter> = cx.new(|_cx| Counter { count: 0 });
let same = counter.clone();

same.update(cx, |counter, _cx| counter.count += 1);
assert_eq!(counter.read(cx).count, 1);

Implementations§

Source§

impl<T: 'static> Entity<T>

Source

pub fn entity_id(&self) -> EntityId

Returns the id of the entity.

Two handles have the same id exactly when they refer to the same entity.

Source

pub fn downgrade(&self) -> WeakEntity<T>

Returns a WeakEntity to the same value.

A weak handle doesn’t keep the value alive. Use it for back-references, and for callbacks that may run after the entity is released.

Source

pub fn into_any(self) -> AnyEntity

Converts this handle into an AnyEntity. The result keeps the value alive, without its type.

Source

pub fn read<'a>(&self, cx: &'a App) -> &'a T

Returns a shared reference to the value, borrowed from the app.

The reference borrows cx, so you can’t update the app while you hold it. Copy out what you need, or work inside a single Entity::update.

§Panics

Panics if this entity is currently being updated, for example when you read it from inside its own Entity::update closure. Use the &mut T that the closure received instead.

§Examples
let name = cx.new(|_cx| String::from("GPUI"));

let len = name.read(cx).len();
name.update(cx, |name, _cx| name.push_str("!"));

assert_eq!(len, 4);
assert_eq!(name.read(cx), "GPUI!");
Source

pub fn read_with<R, C: AppContext>( &self, cx: &C, f: impl FnOnce(&T, &App) -> R, ) -> R

Calls read with the value and the app, and returns what read returns.

Use this when the callback needs the app as well as the value. It works with any AppContext, including Context and AsyncApp. It panics in the same cases as Entity::read.

Source

pub fn update<R, C: AppContext>( &self, cx: &mut C, update: impl FnOnce(&mut T, &mut Context<'_, T>) -> R, ) -> R

Changes the value, and returns what update returns.

update receives a &mut T and a Context<T> for this entity. Use it for every change to an entity. Call Context::notify inside the closure when anything that depends on the value has changed. Effects queued by the closure, such as notifications and events, run when the outermost update finishes.

Pass any AppContext as cx: &mut App, a Context of another entity, or an AsyncApp inside a task.

§Panics

Panics if this entity is already being updated. Updating it from inside its own closure is the usual cause; use the &mut T you were given instead. Updating other entities is fine.

§Examples
struct Counter {
    count: usize,
}

let counter = cx.new(|_cx| Counter { count: 0 });

let count = counter.update(cx, |counter, cx| {
    counter.count += 1;
    cx.notify();
    counter.count
});

assert_eq!(count, 1);
Source

pub fn as_mut<'a, C: AppContext>(&self, cx: &'a mut C) -> GpuiBorrow<'a, T>

Returns a guard that dereferences to the value, so you can change it with * or with methods.

The guard borrows cx for as long as it lives. When the guard is dropped, the entity is notified, as if you had called Context::notify. Use Entity::update when the change needs a Context.

Source

pub fn write<C: AppContext>(&self, cx: &mut C, value: T)

Replaces the value with value, and notifies observers.

§Examples
let name = cx.new(|_cx| String::from("draft"));
name.write(cx, String::from("published"));
assert_eq!(name.read(cx), "published");
Source

pub fn update_in<R, C: VisualContext>( &self, cx: &mut C, update: impl FnOnce(&mut T, &mut Window, &mut Context<'_, T>) -> R, ) -> C::Result<R>

Like Entity::update, but also passes the Window that the entity is shown in.

Use it from a VisualContext, which is a context that has a window. Returns an error if the window has been closed.

Source§

impl<T: 'static> Entity<T>

Source

pub fn next_event<Event>( &self, cx: &mut TestAppContext, ) -> impl Future<Output = Event>
where Event: Send + Clone + 'static, T: EventEmitter<Event>,

Returns a future that resolves with the next event self emits.

The subscription is made when you call this, not when you await the future, so an event emitted in between is still received.

§Panics

Panics if the entity is released before it emits an event.

Source§

impl<V: 'static> Entity<V>

Source

pub fn next_notification( &self, advance_clock_by: Duration, cx: &TestAppContext, ) -> impl Future<Output = ()>

Returns a future that resolves on the entity’s next notification.

This advances the simulated clock by advance_clock_by as soon as you call it, before the future is awaited. Use it when the notification comes from a timer that the advance will fire.

§Panics

Panics if the entity is released while the future waits.

Source§

impl<V> Entity<V>

Source

pub fn condition<Evt>( &self, cx: &TestAppContext, predicate: impl FnMut(&V, &App) -> bool, ) -> impl Future<Output = ()>
where Evt: 'static, V: EventEmitter<Evt>,

Returns a future that resolves when predicate returns true for this entity.

The predicate is checked when the future is first polled, then again after each notification or event from the entity.

§Panics

Panics if the entity is released while the future waits.

Source§

impl<T: Render> Entity<T>

Source

pub fn cached(self, style: StyleRefinement) -> ViewElement<Entity<T>>

Returns this entity as an element laid out at a fixed root style.

An entity passed directly as a child already keeps its output while nothing it read has changed, and sizes itself from its content. Use cached when the parent should decide the view’s root style instead: the view is laid out at style, and its content is laid out within the bounds that style produces. See retained rendering.

Methods from Deref<Target = AnyEntity>§

Source

pub fn entity_id(&self) -> EntityId

Returns the id of the entity.

Source

pub fn entity_type(&self) -> TypeId

Returns the TypeId of the type the entity was created with.

Source

pub fn downgrade(&self) -> AnyWeakEntity

Returns a type-erased weak handle to the same entity. It doesn’t keep the entity alive.

Trait Implementations§

Source§

impl<T> Clone for Entity<T>

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

impl<T> Debug for Entity<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Deref for Entity<T>

Source§

type Target = AnyEntity

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> DerefMut for Entity<T>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> Eq for Entity<T>

Source§

impl<V: Focusable> Focusable for Entity<V>

Source§

fn focus_handle(&self, cx: &App) -> FocusHandle

Returns the focus handle for this view. Read more
Source§

impl<I: ImageCache> From<Entity<I>> for AnyImageCache

Source§

fn from(image_cache: Entity<I>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Entity<T>> for AnyEntity

Source§

fn from(entity: Entity<T>) -> Self

Converts to this type from the input type.
Source§

impl<V: Render> From<Entity<V>> for AnyView

Source§

fn from(value: Entity<V>) -> Self

Converts to this type from the input type.
Source§

impl<T> Hash for Entity<T>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: ImageCache> ImageCacheProvider for Entity<T>

Source§

fn provide(&mut self, _window: &mut Window, _cx: &mut App) -> AnyImageCache

Returns the cache for the children of an image_cache element. Read more
Source§

impl<V: 'static + Render> IntoElement for Entity<V>

Source§

type Element = ViewElement<Entity<V>>

The element type that this type converts into. Read more
Source§

fn into_element(self) -> Self::Element

Converts self into an Element. Read more
Source§

fn into_any_element(self) -> AnyElement

Converts self into an AnyElement, with its concrete type erased. Read more
Source§

impl<T: 'static> Ord for Entity<T>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl<T> PartialEq for Entity<T>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T> PartialEq<Entity<T>> for WeakEntity<T>

Source§

fn eq(&self, other: &Entity<T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T> PartialEq<WeakEntity<T>> for Entity<T>

Source§

fn eq(&self, other: &WeakEntity<T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: 'static> PartialOrd for Entity<T>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: UniformListDecoration + 'static> UniformListDecoration for Entity<T>

Source§

fn compute( &self, visible_range: Range<usize>, bounds: Bounds<Pixels>, scroll_offset: Point<Pixels>, item_height: Pixels, item_count: usize, window: &mut Window, cx: &mut App, ) -> AnyElement

Returns the element to draw, given the rows in view and the list’s geometry. Read more
Source§

impl<T: Render> View for Entity<T>

An entity that renders itself (Render) is a View keyed by its own id.

Source§

fn entity_id(&self) -> Option<EntityId>

Returns the entity that identifies this view, or None for a stateless view. Read more
Source§

fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement

Renders this view into elements. Takes self by value, so the view is used up.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Entity<T>

§

impl<T> !UnwindSafe for Entity<T>

§

impl<T> Freeze for Entity<T>
where PhantomData<fn(T) -> T>: Freeze,

§

impl<T> Send for Entity<T>
where PhantomData<fn(T) -> T>: Send,

§

impl<T> Sync for Entity<T>
where PhantomData<fn(T) -> T>: Sync,

§

impl<T> Unpin for Entity<T>
where PhantomData<fn(T) -> T>: Unpin,

§

impl<T> UnsafeUnpin for Entity<T>
where PhantomData<fn(T) -> T>: UnsafeUnpin,

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<E> AnimationExt for E
where E: IntoElement + 'static,

Source§

fn with_animation( self, id: impl Into<ElementId>, animation: Animation, animator: impl Fn(Self, f32) -> Self + 'static, ) -> AnimationElement<Self>
where Self: Sized,

Renders this element with animation, passing animator the eased progress on every frame. Read more
Source§

fn with_animations( self, id: impl Into<ElementId>, animations: Vec<Animation>, animator: impl Fn(Self, usize, f32) -> Self + 'static, ) -> AnimationElement<Self>
where Self: Sized,

Renders this element with a sequence of animations, one after another. Read more
Source§

fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, T::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
where Self: Sized, T: SpringTarget, T::Output: 'static,

Renders this element at the value of a spring, passed to animator. 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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> FluentBuilder for T
where T: IntoElement,

Source§

fn map<U>(self, f: impl FnOnce(Self) -> U) -> U
where Self: Sized,

Passes self to f, and returns the result. Use it to continue a chain with a closure.
Source§

fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
where Self: Sized,

Calls then with self if condition is true. Otherwise returns self unchanged.
Source§

fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
where Self: Sized,

Calls then with self if condition is true, and else_fn with self otherwise.
Source§

fn when_some<T>( self, option: Option<T>, then: impl FnOnce(Self, T) -> Self, ) -> Self
where Self: Sized,

Calls then with self and the value inside option if the option is Some. Returns self unchanged for None.
Source§

fn when_none<T>( self, option: &Option<T>, then: impl FnOnce(Self) -> Self, ) -> Self
where Self: Sized,

Calls then with self if option is None. The option is taken by reference, so you can still use it afterward.
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<K> MapSeekTarget<K> for K
where K: Ord,

Source§

fn cmp_cursor(&self, cursor_location: &K) -> Ordering

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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