rpcnet 0.1.0

RPC library based on QUIC+TLS encryption
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# Development Guide

Quick reference for common development tasks.

## Quick Start

```bash
# Run tests with linting (recommended for local development)
make test

# Just run tests (faster, skip linting)
make test-quick

# Run everything before committing
make pre-commit
```

## Testing

### Basic Testing

```bash
# Run all tests + quick lint (recommended)
make test

# Run tests only (faster)
make test-quick
# or
make test-only

# Run unit tests only
make test-unit

# Run integration tests only
make test-integration
```

### What `make test` does:
1. Runs all tests
2. Runs clippy on lib + bins (catches most issues)
3. Shows a summary

**Time:** ~30-60 seconds (depending on cache)

## Pre-Commit Checks

Before committing your code:

```bash
make pre-commit
```

This runs:
1. ✅ Auto-formats code (`cargo fmt`)
2. ✅ Quick lint check (lib + bins)
3. ✅ Unit tests

**Time:** ~30-60 seconds

**Tip:** Run this before every commit to catch issues early!

## Linting

```bash
# Quick lint (lib + bins only, used by make test)
make lint-quick

# Full lint (all targets including tests, examples, benches)
make lint

# Auto-fix simple issues
cargo clippy --fix
```

### Why two lint commands?

- **`lint-quick`** - Fast, catches 95% of issues (used by `make test`)
- **`lint`** - Comprehensive, checks everything (used by CI)

## Formatting

```bash
# Format code
make format

# Check if formatted (doesn't modify files)
make format-check
```

**Tip:** Configure your editor to auto-format on save!

## Coverage

```bash
# Generate coverage report (HTML)
make coverage-html

# Check if coverage meets 65% threshold
make coverage-check

# Find uncovered lines
make coverage-gaps
```

## Documentation

```bash
# Build and open docs
make doc

# Build including private items
make doc-private

# Build user guide (mdbook)
make doc-book

# Serve user guide with live reload
make doc-book-serve
```

## Benchmarks

```bash
# Run all benchmarks
make bench
```

## Examples

```bash
# Build all examples
make examples
```

## Pre-Release Checks

Before creating a release:

```bash
# Run all publication checks
make publish-check

# Dry run (see what would be published)
make publish-dry-run
```

This runs:
1. All tests (all features)
2. Format check
3. Full clippy lint (all targets)
4. Documentation build

**Time:** ~5-10 minutes

## Continuous Development

Watch files and run tests on changes:

```bash
make dev-watch
```

Requires: `cargo install cargo-watch`

## Common Workflows

### Before Starting Work

```bash
git checkout main
git pull
cargo update
make test
```

### During Development

```bash
# Make changes...
make test          # Quick check after changes
# Make more changes...
make test          # Check again
```

### Before Committing

```bash
make pre-commit    # Auto-formats + checks everything
git add .
git commit -m "feat: add new feature"
```

### Before Pushing

```bash
# Optional: run full CI checks locally
make ci

# Or just the quick pre-commit
make pre-commit
git push
```

### Before Release

```bash
# Update version in Cargo.toml
make publish-check    # Full validation
make publish-dry-run  # See what will be published

# Create release
git tag v0.2.1
git push origin v0.2.1
# GitHub Actions handles the rest!
```

## CI Commands

These are used by GitHub Actions but can be run locally:

```bash
make ci           # Run all CI checks
make ci-test      # CI test suite
make ci-lint      # CI linting
make ci-coverage  # CI coverage
make ci-security  # Security audit
```

## Troubleshooting

### Tests failing?

```bash
# Run with output
cargo test -- --nocapture

# Run specific test
cargo test test_name

# Run with backtrace
RUST_BACKTRACE=1 cargo test
```

### Clippy errors?

```bash
# Auto-fix simple issues
cargo clippy --fix

# See detailed explanation
cargo clippy -- -W clippy::all -W clippy::pedantic

# Allow specific lint (in code)
#[allow(clippy::lint_name)]
```

### Format issues?

```bash
# Format everything
make format

# Check what would change
cargo fmt -- --check
```

### Coverage too low?

```bash
# See coverage gaps
make coverage-gaps

# Generate detailed HTML report
make coverage-html
```

### Build issues?

```bash
# Clean everything
make clean

# Or more aggressive
cargo clean
rm -rf target/

# Rebuild
cargo build
```

## Tips & Best Practices

### 1. Run `make test` frequently
- Catches issues early
- Fast enough for frequent use (~30-60s)
- Includes linting

### 2. Use `make pre-commit` before committing
- Ensures code is formatted
- Catches clippy warnings
- Runs tests
- Takes ~30-60s

### 3. Let CI do the heavy lifting
- CI runs full checks on all platforms
- You don't need to run everything locally
- Focus on fast local iteration

### 4. Configure your editor
- Auto-format on save
- Show clippy warnings inline
- Run tests in the background

### 5. Use watch mode during development
```bash
make dev-watch
```

### 6. Commit often with good messages
```bash
git commit -m "type: brief description"
```

Types: `feat`, `fix`, `docs`, `test`, `refactor`, `chore`

## Speed Comparison

| Command | Time | When to Use |
|---------|------|-------------|
| `make test` | ~30-60s | After every change (recommended) |
| `make pre-commit` | ~30-60s | Before committing |
| `make lint` | ~2min | Occasionally, CI does this |
| `make publish-check` | ~5-10min | Before release |
| `make coverage-html` | ~10min | When checking coverage |

## Editor Setup

### VS Code

Install extensions:
- `rust-analyzer` - Code intelligence
- `Even Better TOML` - TOML syntax

Settings (`settings.json`):
```json
{
  "rust-analyzer.checkOnSave.command": "clippy",
  "editor.formatOnSave": true,
  "[rust]": {
    "editor.defaultFormatter": "rust-lang.rust-analyzer"
  }
}
```

### Vim/Neovim

Use `rust.vim` or `nvim-lsp` with `rust-analyzer`.

### IntelliJ/CLion

Use the Rust plugin with built-in clippy and rustfmt integration.

## Getting Help

- Run `make help` to see all commands
- Check `Makefile` for command details
- See `.github/workflows/` for CI configuration
- Read `RELEASE.md` for release process
- Open an issue if you find bugs

## Environment Variables

```bash
# Enable backtraces
export RUST_BACKTRACE=1

# Verbose output
export RUST_LOG=debug

# Faster compilation (less optimization)
export CARGO_PROFILE_DEV_OPT_LEVEL=0
```

## Useful Cargo Commands

```bash
# Update dependencies
cargo update

# Check without building
cargo check

# Build release version
cargo build --release

# Run specific example
cargo run --example calculator_client

# Clean build artifacts
cargo clean

# Show dependency tree
cargo tree
```

---

Happy coding! 🦀