mirror of
https://codeberg.org/JasterV/granc.git
synced 2026-04-26 18:40:05 +00:00
This PR makes the `--file-descriptor-set` CLI option to be global for all the commands. By consequence, the `GrancClient` has been refactored to use a typestate pattern to ensure that there are two separate and decoupled implementations of the behaviour of the client when a file descriptor is loaded and when server reflection is enabled, since both cases have by nature separate error cases and return values invariants. It also significantly improves the documentation for both the main `README.md` and the `granc-core/README.md`, clarifying usage patterns, command-line options, and the internal architecture of the `GrancClient` API. **API and architecture changes:** * Refactored `granc-core/src/client.rs` to implement the typestate pattern for `GrancClient`, splitting logic into `with_server_reflection` and `with_file_descriptor` modules. Updated documentation comments to explain state transitions and usage. * Simplified the `DynamicRequest` struct by removing the `file_descriptor_set` field, as schema resolution is now determined by the client's state rather than per-request. **Documentation improvements:** * Expanded and reorganized the main `README.md` to clearly explain new and existing features, including local introspection, command-line options, and usage examples for both server reflection and local file descriptor sets. The documentation now covers how to use introspection commands with and without server reflection, and provides concrete example commands and expected output. [[1]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R16-R33) [[2]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L60-R73) [[3]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L84-R159) * Updated the `granc-core/README.md` to document the typestate pattern of `GrancClient`, provide clear async/sync usage examples for both reflection and file descriptor modes, and clarify schema introspection methods.
36 lines
1,000 B
TOML
36 lines
1,000 B
TOML
[package]
|
|
authors = { workspace = true }
|
|
categories = ["network-programming"]
|
|
description = "Cranc gRPC CLI core library"
|
|
edition = { workspace = true }
|
|
homepage = { workspace = true }
|
|
keywords = ["grpc", "network-programming", "grpc-reflection"]
|
|
license = { workspace = true }
|
|
name = "granc_core"
|
|
publish = true
|
|
readme = "README.md"
|
|
repository = { workspace = true }
|
|
rust-version = { workspace = true }
|
|
version = "0.4.1"
|
|
|
|
[lib]
|
|
name = "granc_core"
|
|
path = "src/lib.rs"
|
|
|
|
[dependencies]
|
|
futures-util = "0.3.31"
|
|
http = "1.4.0"
|
|
http-body = "1.0.1"
|
|
prost = { workspace = true }
|
|
prost-reflect = { workspace = true, features = ["serde"] }
|
|
prost-types = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
thiserror = "2.0.18"
|
|
tokio = { workspace = true, features = ["sync"] }
|
|
tokio-stream = "0.1.18"
|
|
tonic = { workspace = true }
|
|
tonic-reflection = { workspace = true }
|
|
|
|
[dev-dependencies]
|
|
echo-service = { path = "../echo-service" }
|
|
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
|