pamoja-core 0.1.17

Core engine for the pamoja device SDK: device model, transport, event bus, and error types.
Documentation
<!-- Generated by `cargo xtask docs` from this crate's lib.rs; edit the crate doc, not this file. -->

# pamoja-core

Core engine for the pamoja device SDK: device model, transport, event bus, and error types.

<a href="https://pamoja.molex.cloud/docs/reference/rust/pamoja_core/index.html"><img height="28" alt="API reference" src="https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-api.svg"></a>
<a href="https://crates.io/crates/pamoja-core"><img height="28" alt="crates.io" src="https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-cratesio.svg"></a>
<a href="https://docs.rs/pamoja-core"><img height="28" alt="docs.rs" src="https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-docsrs.svg"></a>
<a href="https://www.npmjs.com/package/@pamoja/core"><img height="28" alt="npm" src="https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-npm.svg"></a>
<a href="https://pypi.org/project/pamoja-core/"><img height="28" alt="PyPI" src="https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-pypi.svg"></a>
<a href="https://www.nuget.org/packages/Pamoja.Core"><img height="28" alt="NuGet" src="https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-nuget.svg"></a>

The full API reference is [on the site](https://pamoja.molex.cloud/docs/reference/rust/pamoja_core/index.html), and the copy for each published version is on [docs.rs](https://docs.rs/pamoja-core).

Core abstractions for the pamoja device SDK.

This crate defines the traits that every capability crate (for example
`pamoja-mqtt`, `pamoja-serial`, or `pamoja-ros2`) implements. The
core is protocol-agnostic: it models devices, sensors, actuators, transports,
durable storage, and an event bus, and leaves concrete protocol support to the
capability crates so that an application depends only on what it uses.

The primary abstractions are:

- `Device` - a connectable physical or virtual device.
- `Sensor` - a source of typed readings.
- `Actuator` - a sink for typed commands.
- `Telemetry` - a stream of telemetry frames.
- `Transport` - a bidirectional byte transport.
- `Store` - a durable store-and-forward queue.
- `EventBus` - a typed publish/subscribe channel.
- `Error` and `Result` - the shared error model.

**Examples**

Implementing `Sensor` for a temperature probe:

```rust
use pamoja_core::{Result, Sensor};

struct Thermometer {
    celsius: f32,
}

impl Sensor for Thermometer {
    type Reading = f32;

    async fn read(&mut self) -> Result<Self::Reading> {
        Ok(self.celsius)
    }
}

let _probe = Thermometer { celsius: 20.5 };
```

## License

MIT - part of the [pamoja](https://github.com/molexxxx/pamoja) workspace: one memory-safe Rust core with bindings for every language.