16 stable releases
| new 1.25.1 | Nov 12, 2025 |
|---|---|
| 1.24.0 | Aug 18, 2025 |
| 1.22.0 | Jun 12, 2025 |
| 1.19.0 | Mar 31, 2025 |
| 1.15.1 | Oct 22, 2024 |
#715 in Embedded development
Used in memfaultd
49KB
1.5K
SLoC
Simple Service Framework
This library provides a simple abstraction to implement a service oriented architecture in a non-async Rust program.
Each service runs in its own thread with a processing loop waiting on a channel.
This library provides a few essential traits:
Service: a trait implemented by servicesMessage: a trait implemented by messagesHandler<M: Message>: a trait implemented by services that can handle messages of typeM.
We provide some important structs to deploy the services:
ServiceThread: will start and run a service inside a dedicated thread. It returns aMailbox.Mailbox<S: Service>: a lightweight (cheap toclone()) handle to send messages to a thread.Scheduler: a utility thread which keeps a schedule of messages that need to be sent at fixed intervals.
As well as important testing utilities that are a big part of the value provided by this framework:
ServiceJig: a way to run a service inside a test without using threads. The test can precisely decide when messages should be delivered and inspect the state of the service at any time.ServiceMock: a service mock. Use this when you just need a place where to send messages. Your test can then verify that the right messages were sent to the mock.
memfault-ssf
Internal crate for use by the
memfaultd crate, not for general
use.
Dependencies
~3–14MB
~131K SLoC