# MediaContextClock

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/struct-mediacontextclock/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct MediaContextClock
```

The global animation clock: pulsed once per frame by the media context
with the time elapsed since the media context started.

Subscribing schedules a render pass, so that the clock keeps ticking
while anything observes it.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/media_context_clock.rs#L17)

## Members

- [`has_new_subscriptions`](#function-has_new_subscriptions)
- [`has_subscriptions`](#function-has_subscriptions)
- [`request_animation_frame`](#function-request_animation_frame)

<a id="function-has_new_subscriptions"></a>

### has_new_subscriptions

```rust
fn has_new_subscriptions(self: &Self) -> bool
```

Whether observers subscribed since the last pulse.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/media_context_clock.rs#L39)

<a id="function-has_subscriptions"></a>

### has_subscriptions

```rust
fn has_subscriptions(self: &Self) -> bool
```

Whether anything is waiting for the next pulse.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/media_context_clock.rs#L44)

<a id="function-request_animation_frame"></a>

### request_animation_frame

```rust
fn request_animation_frame(self: &Self, action: impl FnOnce(SignedDuration) -> () + 'static)
```

Runs `action` with the frame time on the next pulse.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/media_context_clock.rs#L49)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`SubscribeGuard<T>`](/docs/0.5.0/api/ferroui-base/reactive/use-subscribeguard/)
- `ErasedDestructor`
- `IntoEither`
- [`IObservable<SignedDuration>`](/docs/0.5.0/api/ferroui-base/reactive/use-iobservable/)
- [`IClock`](/docs/0.5.0/api/ferroui-base/animation/trait-iclock/)
- [`IGlobalClock`](/docs/0.5.0/api/ferroui-base/animation/trait-iglobalclock/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
