<div align="center">
# ◈ CARGO MEMLENSE ◈
### `[ STATIC ANALYSIS & SEMANTIC LINTING SUITE ]`
[](https://crates.io/crates/cargo-memlense)
[](../LICENSE.md)
---
```
██████╗ █████╗ ██████╗ ██████╗ ██████╗
██╔════╝██╔══██╗██╔══██╗██╔════╝ ██╔═══██╗
██║ ███████║██████╔╝██║ ███╗██║ ██║
██║ ██╔══██║██╔══██╗██║ ██║██║ ██║
╚██████╗██║ ██║██║ ██║╚██████╔╝╚██████╔╝
╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝
```
> *"Detecting what the compiler accepts, but the system forbids."*
**The official static analysis tool for the Memkit ecosystem. Ensures your memory patterns adhere to deterministic constraints and task-local safety rules.**
[`◈ INSTALLATION`](#◈-installation) • [`◈ CATEGORIES`](#◈-diagnostic-categories) • [`◈ ARCHITECTURE`](#◈-architecture)
</div>
---
## ◈ THE MEMLENSE ADVANTAGE
| **Arena Safety** | Ignored | **Scope Validation** | No escapes |
| **Async Leaks** | Runtime | **Compile-time** | Fast feedback |
| **Perf Hints** | Basic | **Cache-Locality** | Latency wins |
| **Patterns** | General | **Specialized** | Intent-driven |
---
## ◈ FEATURES
```
┌─────────────────────────────────────────────────────────────────────────┐
│ ◆ SCOPE GUARD │ Detects when frame allocations leak across boundaries │
│ │ of `begin_frame` and `end_frame`. │
├─────────────────────────────────────────────────────────────────────────┤
│ ◆ ASYNC AUDIT │ Identifies allocations held across `.await` points, │
│ │ preventing dangerous task-migration leaks. │
├─────────────────────────────────────────────────────────────────────────┤
│ ◆ EXPLAIN │ Rich diagnostic explainers for every rule. Simply run │
│ │ `cargo memlense explain <CODE>`. │
└─────────────────────────────────────────────────────────────────────────┘
```
---
## ◈ INSTALLATION
```bash
# Install the linter binary
cargo install cargo-memlense
```
---
## ◈ QUICK START
```bash
# Analyze your entire workspace
cargo memlense check
# Check a specific module for async violations
cargo memlense check src/network.rs --rules ML6
# Detailed explanation of a diagnostic
cargo memlense explain ML602
```
---
## ◈ DIAGNOSTIC CATEGORIES
| **`ML1xx`** | Frame Lifecycle | Lifetime mismatches |
| **`ML2xx`** | Threading | Cross-thread ownership hazards |
| **`ML3xx`** | GPU Sync | Device/Staging coordination errors |
| **`ML4xx`** | Performance | Cache locality & alignment tips |
| **`ML6xx`** | Async Safety | Task-local boundary checks |
---
## ◈ ARCHITECTURE
```mermaid
graph TD
Source([Source Code]) --> Parser[memlense Parser]
Parser --> Engine{Semantic Rules}
Engine -->|Console| UI[Rich Diagnostic TUI]
Engine -->|JSON| CI[CI/CD Artifacts]
```
---
## ◈ LICENSE
Licensed under the **Mozilla Public License 2.0**.
---
<div align="center">
**[ Part of the ◈ MEMKIT ◈ Ecosystem ]**
</div>