Tags: init4tech/ajj
Tags
feat: add permit APIs and notification_capacity to HandlerCtx (#40) Expose backpressure-aware permit APIs on HandlerCtx that mirror tokio's mpsc::Sender reserve surface. Users can now reserve channel capacity before sending, with both borrowed and owned permit types. New types: NotifyPermit, OwnedNotifyPermit New methods: permit, permit_owned, try_permit, try_permit_owned, permit_many, try_permit_many, notification_capacity Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
feat!: add consuming into_raw_value to RpcSend (#37) * feat!: add consuming `into_raw_value` to `RpcSend`, remove `Serialize` supertrait `RpcSend` previously required `Serialize` as a supertrait, forcing lazy producers like iterators to use `Mutex<Option<T>>` wrappers for interior mutability during serialization. This replaces the marker trait with a consuming `into_raw_value(self)` method, enabling direct ownership transfer during serialization. The blanket impl for `T: Serialize` is preserved, so all existing code that returns `Serialize` types from handlers continues to work. Types that do not implement `Serialize` can now implement `RpcSend` directly with custom serialization logic. BREAKING CHANGE: `RpcSend` no longer has `Serialize` as a supertrait. Code that used `T: RpcSend` and relied on the `Serialize` bound will need to add an explicit `Serialize` bound. `HandlerCtx::notify` now takes `T` by value instead of `&T` (callers passing `&item` still work via the blanket impl). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address review feedback - Deprecate `ErrorPayload::serialize_payload` in favor of `into_raw` - Eliminate extra serialization round in `build_response` by constructing the JSON envelope directly via format!, bypassing the Response struct Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: use types instead of hand-crafted JSON in response serialization Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: generalize Response Serialize bounds to RpcSend Response now owns the payload via Cell<Option<...>> so the Serialize impl can consume it. Bounds are T: RpcSend, E: RpcSend instead of T: Serialize, E: Serialize. build_response no longer needs to call into_raw explicitly — it's handled inside the Serialize impl. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Revert "refactor: generalize Response Serialize bounds to RpcSend" This reverts commit 1383288. * fix: memoize parse_error response and serialization_failure payload - parse_error() now clones from a LazyLock<Box<RawValue>> instead of serializing on every call - serialization_failure() borrows a static ResponsePayload instead of reconstructing it per invocation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
PreviousNext