Skip to content

Commit 42cc2cc

Browse files
authored
Merge branch 'main' into trust
2 parents 602f0a0 + d9700ca commit 42cc2cc

File tree

55 files changed

+581
-18
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+581
-18
lines changed

README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
[![Build Status](https://dev.azure.com/swimai-build/swim-rust/_apis/build/status/swimos.swim-rust?branchName=main)](https://dev.azure.com/swimai-build/swim-rust/_build/latest?definitionId=1&branchName=main)
2-
[![codecov](https://codecov.io/gh/swimos/swim-rust/branch/main/graph/badge.svg?token=IVWBLXCGW8)](https://codecov.io/gh/swimos/swim-rust)
31
<a href="https://www.swimos.org"><img src="https://docs.swimos.org/readme/marlin-blue.svg" align="left"></a>
42
<br><br><br><br>
53

@@ -19,18 +17,29 @@ will also allow the subscriber to request changes to the state (for lane kinds t
1917
operate over a web-socket connection and are multiplexed, meaning that links to multiple lanes on the same
2018
host can share a single web-socket connection.
2119

20+
![SwimOS Crates.io Version](https://img.shields.io/crates/v/swimos?label=swimos) ![SwimOS Form Crates.io Version](https://img.shields.io/crates/v/swimos_form?label=swimos_form) ![SwimOS Client Crates.io Version](https://img.shields.io/crates/v/swimos_client?label=swimos_client)
21+
22+
[Website](https://swimos.org/) | [Developer Guide](https://www.swimos.org/server/rust/developer-guide/) | [Server API Docs](https://docs.rs/swimos/latest/swimos/) | [Client API Docs](https://docs.rs/swimos_client/latest/swimos_client/)
23+
2224
## Usage Guides
2325

2426
[Implementing Swim Agents in Rust](docs/agent.md)
2527

2628
[Building a Swim Server Application](docs/server.md)
2729

30+
[Reference Documentation](https://www.swimos.org/server/rust/)
31+
2832
## Examples
2933

3034
The following example application runs a SwimOS server that hosts a single agent route where each agent instance
3135
has single lane, called `lane`. Each time a changes is made to the lane, it will be printed on the console by the
3236
server.
3337

38+
```toml
39+
[dependencies]
40+
swimos = { version = "0.1.0", features = ["server", "agent"] }
41+
```
42+
3443
```rust
3544
use swimos::{
3645
agent::{
@@ -46,7 +55,6 @@ use swimos::{
4655

4756
#[tokio::main]
4857
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
49-
5058
// An agent route consists of the agent definition and a lifecycle.
5159
let model = AgentModel::new(ExampleAgent::default, ExampleLifecycle.into_lifecycle());
5260

@@ -80,7 +88,6 @@ struct ExampleLifecycle;
8088
// annotated event handlers methods in the block.
8189
#[lifecycle(ExampleAgent)]
8290
impl ExampleLifecycle {
83-
8491
#[on_event(lane)]
8592
fn lane_event(
8693
&self,
@@ -94,12 +101,11 @@ impl ExampleLifecycle {
94101
})
95102
})
96103
}
97-
98104
}
99105
```
100106

101-
For example, if a Swim client sends an update, with the value `5`, to the agent at the URI `/examples/name` for the
102-
lane `lane`, an instance of `ExampleAgent`, using `ExampleLifecycle`, will be started by the server. The value of the
107+
For example, if a Swim client sends an update, with the value `5`, to the agent at the URI `/examples/name` for the
108+
lane `lane`, an instance of `ExampleAgent`, using `ExampleLifecycle`, will be started by the server. The value of the
103109
lane will then be set to `5` and the following will be printed on the console:
104110

105111
```
@@ -108,4 +114,8 @@ Received value: 5 for 'lane' on agent at URI: /examples/name.
108114

109115
## Development
110116

111-
See the [development guide](DEVELOPMENT.md).
117+
See the [development guide](DEVELOPMENT.md).
118+
119+
## License
120+
121+
This project is licensed under the [Apache 2.0 License](LICENSE).

api/formats/swimos_recon/src/comparator/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2022 Swim Inc.
1+
// Copyright 2015-2024 Swim Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

api/formats/swimos_recon/src/comparator/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2022 Swim Inc.
1+
// Copyright 2015-2024 Swim Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

api/formats/swimos_recon/src/hasher/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2022 Swim Inc.
1+
// Copyright 2015-2024 Swim Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

api/formats/swimos_recon/src/hasher/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2022 Swim Inc.
1+
// Copyright 2015-2024 Swim Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

api/formats/swimos_recon/src/recon_parser/record/hash.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2022 Swim Inc.
1+
// Copyright 2015-2024 Swim Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -11,6 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14+
1415
use super::{separator, AttrBody, EventOrEnd, IncrementalReconParser, ItemsKind, RecBody, Span};
1516
use crate::hasher::HashError;
1617
use nom::branch::alt;

api/swimos_api/src/agent/lane/tests.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2015-2024 Swim Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
use crate::agent::UplinkKind;
216

317
use super::WarpLaneKind;

example_apps/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Applications
2+
3+
This directory contains a number of example applications for building SwimOS applications and also contains example
4+
binaries for their corresponding client applications. Each directory contains details about running the binaries.
5+
6+
- [aggregations](aggregations): Reference code for
7+
the [Group and Aggregate Agents](https://www.swimos.org/server/rust/aggregations/) guide.
8+
- [command_lane](command_lane): Application demonstrating Command Lanes.
9+
- [demand_lane](demand_lane): Application demonstrating Demand Lanes.
10+
- [demand_map_lane](demand_map_lane): Application demonstrating Demand Map Lanes.
11+
- [devguide](devguide): Reference code for the [Developer Guide](https://www.swimos.org/server/rust/developer-guide/).
12+
- [event_downlink](event_downlink): Application demonstrating Event Downlinks.
13+
- [http_lane](http_lane): Application demonstrating HTTP Lanes.
14+
- [join_map](join_map): Application demonstrating Join Map Lanes.
15+
- [join_value](join_value): Application demonstrating Join Value Lanes.
16+
- [local_downlink](local_downlink): Application demonstrating Downlinks.
17+
- [map_downlink](map_downlink): Application demonstrating Map Downlinks.
18+
- [map_lane](map_lane): Application demonstrating Map Lanes.
19+
- [map_lane_persistence](map_lane_persistence): Application demonstrating Map Lanes with persistence.
20+
- [map_store](map_store): Application demonstrating Map Stores.
21+
- [map_store_persistence](map_store_persistence): Application demonstrating Map Stores with persistence.
22+
- [supply_lane](supply_lane): Application demonstrating Supply Lanes.
23+
- [time_series](time_series): Reference code for the [Time Series](https://www.swimos.org/server/rust/time-series/)
24+
guide.
25+
- [transit](transit): Rust port of the [Transit](https://github.com/swimos/transit) application.
26+
- [value_downlink](value_downlink): Application demonstrating Value Downlinks.
27+
- [value_lane](value_lane): Application demonstrating Value Lanes.
28+
- [value_lane_persistence](value_lane_persistence): Application demonstrating Value Lanes with persistence.
29+
- [value_store](value_store): Application demonstrating Value Stores.
30+
- [value_store_persistence](value_store_persistence): Application demonstrating Value Stores with persistence.

example_apps/aggregations/src/bin/aggregations_client.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2015-2024 Swim Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
use std::error::Error;
216
use swimos_client::{BasicValueDownlinkLifecycle, RemotePath, SwimClientBuilder};
317

example_apps/aggregations/src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
//! Reference code for the [Group and Aggregate Agents](https://www.swimos.org/server/rust/aggregations/) guide.
16+
//!
17+
//! Run this example using the following:
18+
//! ```text
19+
//! $ cargo run --bin aggregations
20+
//! ```
21+
1522
use std::error::Error;
1623
use std::str::FromStr;
1724
use std::time::Duration;

0 commit comments

Comments
 (0)