slint-ui/slint · error
The platform abstraction must implement…
Error message
The platform abstraction must implement `duration_since_start`
What it means
Platform::duration_since_start's default implementation only works with the `std` feature; without std it is unimplemented!() to force platform implementors to provide a monotonic time source. This panic means a custom Platform on a no_std target did not override duration_since_start.
Solutions
- Override duration_since_start in your Platform impl with a monotonic hardware tick (e.g. from a timer peripheral)
- Return Duration from a monotonic counter initialized at platform startup
- If std is actually available, rebuild with the `std` feature so the default implementation is compiled in
Example fix
// before
struct MyPlatform;
impl Platform for MyPlatform { /* no duration_since_start */ }
// after
impl Platform for MyPlatform {
fn duration_since_start(&self) -> core::time::Duration {
core::time::Duration::from_millis(hardware_tick_ms())
}
} Defensive patterns
Strategy: validation
Validate before calling
// compile-time: require an override on no_std
#[cfg(not(feature = "std"))]
const _: () = {
// review checklist: Platform impls must override duration_since_start
}; Try / catch
// unimplemented! panics; the guard is implementing the trait method before first timer/animation use
impl Platform for MyPlatform {
fn duration_since_start(&self) -> core::time::Duration { Duration::from_millis(tick_ms()) }
} Prevention
- When writing a no_std Platform, implement duration_since_start first, from a monotonic tick source
- Enable the `std` feature when std is actually available
- Exercise timers/animations early in embedded bring-up to catch missing overrides immediately
When it happens
Trigger: Implementing the Platform trait for a no_std embedded target and not overriding duration_since_start, then Slint core requests the elapsed time (animations, timers, input timestamps).
Common situations: Bare-metal/embedded ports using the software renderer without std; bringing up a custom platform adapter where the time function was overlooked; copying a std-based Platform impl into a no_std build.
Understand the failure class
Background: "NotImplementedError: Subclasses should override this method" / "must be implemented" — abstract method errors explained — this error's family across 40 libraries.
Related errors
- failed: exited with
- Components written in Rust can not get embedded yet.
- Could not load the slint-dev development binary
- Error compiling keymap
- ExtraBuiltinFunctionCall
AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16).
Data as JSON: /api/errors/77421df670ed97a2.
Report an issue: GitHub.
Appendix: source
Thrown at internal/core/platform.rs:118
}
/// Returns the current time as a monotonic duration since the start of the program
///
/// This is used by the animations and timer to compute the elapsed time.
///
/// When the `std` feature is enabled, this function is implemented in terms of
/// [`std::time::Instant::now()`], but on `#![no_std]` platform, this function must
/// be implemented.
fn duration_since_start(&self) -> core::time::Duration {
#[cfg(feature = "std")]
{
let the_beginning = *INITIAL_INSTANT.get_or_init(time::Instant::now);
let now = time::Instant::now();
assert!(now >= the_beginning, "The platform's clock is not monotonic!");
now - the_beginning
}
#[cfg(not(feature = "std"))]
unimplemented!("The platform abstraction must implement `duration_since_start`")
}
/// Returns the current interval to internal measure the duration to send a double click event.
///
/// A double click event is a series of two pointer clicks.
fn click_interval(&self) -> core::time::Duration {
// 500ms is the default delay according to https://en.wikipedia.org/wiki/Double-click#Speed_and_timing
core::time::Duration::from_millis(500)
}
/// Returns the current rate at which the text cursor should flash or blink.
///
/// This is the length of the entire visible-hidden-visible cycle, so for a duration of 1000ms
/// it is visible for 500ms then hidden for 500ms, then visible again.
///
/// If this value is `Duration::ZERO` then the cycle is disabled.
fn cursor_flash_cycle(&self) -> core::time::Duration {
core::time::Duration::from_millis(1000)View on GitHub (pinned to bb937076de)