-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor ConnectionActor queue handling #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,19 +17,27 @@ pub struct FrameContainer<F> { | |||||||||||||||||||||
| impl<F> FrameContainer<F> { | ||||||||||||||||||||||
| /// Create a new container holding `frame` bytes. | ||||||||||||||||||||||
| #[must_use] | ||||||||||||||||||||||
| pub fn new(frame: F) -> Self { Self { frame } } | ||||||||||||||||||||||
| pub fn new(frame: F) -> Self { | ||||||||||||||||||||||
| Self { frame } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Borrow the inner frame data. | ||||||||||||||||||||||
| #[must_use] | ||||||||||||||||||||||
| pub fn frame(&self) -> &F { &self.frame } | ||||||||||||||||||||||
| pub fn frame(&self) -> &F { | ||||||||||||||||||||||
| &self.frame | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Mutable access to the frame data. | ||||||||||||||||||||||
| #[must_use] | ||||||||||||||||||||||
| pub fn frame_mut(&mut self) -> &mut F { &mut self.frame } | ||||||||||||||||||||||
| pub fn frame_mut(&mut self) -> &mut F { | ||||||||||||||||||||||
| &mut self.frame | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Consume the container, returning the frame. | ||||||||||||||||||||||
| #[must_use] | ||||||||||||||||||||||
| pub fn into_inner(self) -> F { self.frame } | ||||||||||||||||||||||
| pub fn into_inner(self) -> F { | ||||||||||||||||||||||
| self.frame | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Incoming request wrapper passed through middleware. | ||||||||||||||||||||||
|
|
@@ -49,15 +57,21 @@ impl ServiceRequest { | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Borrow the underlying frame bytes. | ||||||||||||||||||||||
| #[must_use] | ||||||||||||||||||||||
| pub fn frame(&self) -> &[u8] { self.inner.frame().as_slice() } | ||||||||||||||||||||||
| pub fn frame(&self) -> &[u8] { | ||||||||||||||||||||||
| self.inner.frame().as_slice() | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Mutable access to the inner frame bytes. | ||||||||||||||||||||||
| #[must_use] | ||||||||||||||||||||||
| pub fn frame_mut(&mut self) -> &mut Vec<u8> { self.inner.frame_mut() } | ||||||||||||||||||||||
| pub fn frame_mut(&mut self) -> &mut Vec<u8> { | ||||||||||||||||||||||
| self.inner.frame_mut() | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Consume the request, returning the inner frame bytes. | ||||||||||||||||||||||
| #[must_use] | ||||||||||||||||||||||
| pub fn into_inner(self) -> Vec<u8> { self.inner.into_inner() } | ||||||||||||||||||||||
| pub fn into_inner(self) -> Vec<u8> { | ||||||||||||||||||||||
| self.inner.into_inner() | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Response produced by a handler or middleware. | ||||||||||||||||||||||
|
|
@@ -77,15 +91,21 @@ impl ServiceResponse { | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Borrow the inner frame bytes. | ||||||||||||||||||||||
| #[must_use] | ||||||||||||||||||||||
| pub fn frame(&self) -> &[u8] { self.inner.frame().as_slice() } | ||||||||||||||||||||||
| pub fn frame(&self) -> &[u8] { | ||||||||||||||||||||||
| self.inner.frame().as_slice() | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Mutable access to the response frame bytes. | ||||||||||||||||||||||
| #[must_use] | ||||||||||||||||||||||
| pub fn frame_mut(&mut self) -> &mut Vec<u8> { self.inner.frame_mut() } | ||||||||||||||||||||||
| pub fn frame_mut(&mut self) -> &mut Vec<u8> { | ||||||||||||||||||||||
| self.inner.frame_mut() | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Consume the response, yielding the raw frame bytes. | ||||||||||||||||||||||
| #[must_use] | ||||||||||||||||||||||
| pub fn into_inner(self) -> Vec<u8> { self.inner.into_inner() } | ||||||||||||||||||||||
| pub fn into_inner(self) -> Vec<u8> { | ||||||||||||||||||||||
| self.inner.into_inner() | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Continuation used by middleware to call the next service in the chain. | ||||||||||||||||||||||
|
|
@@ -120,7 +140,9 @@ where | |||||||||||||||||||||
| /// ``` | ||||||||||||||||||||||
| #[inline] | ||||||||||||||||||||||
| #[must_use] | ||||||||||||||||||||||
| pub fn new(service: &'a S) -> Self { Self { service } } | ||||||||||||||||||||||
| pub fn new(service: &'a S) -> Self { | ||||||||||||||||||||||
| Self { service } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Call the next service with the provided request. | ||||||||||||||||||||||
| /// | ||||||||||||||||||||||
|
|
@@ -157,7 +179,11 @@ where | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Create a new middleware service wrapping `service`. | ||||||||||||||||||||||
| #[inline] | ||||||||||||||||||||||
| #[allow(clippy::inline_fn_without_body, unused_attributes)] | ||||||||||||||||||||||
| #[allow( | ||||||||||||||||||||||
| clippy::inline_fn_without_body, | ||||||||||||||||||||||
| unused_attributes, | ||||||||||||||||||||||
| reason = "future-proof attribute and inline hint without body" | ||||||||||||||||||||||
| )] | ||||||||||||||||||||||
|
Comment on lines
+182
to
+186
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace The coding guidelines explicitly forbid Apply this diff to fix the compliance issue: -#[allow(
- clippy::inline_fn_without_body,
- unused_attributes,
- reason = "future-proof attribute and inline hint without body"
-)]
+#[expect(
+ clippy::inline_fn_without_body,
+ unused_attributes,
+ reason = "future-proof attribute and inline hint without body"
+)]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| #[must_use = "use the returned middleware service"] | ||||||||||||||||||||||
| async fn transform(&self, service: S) -> Self::Output; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
@@ -173,7 +199,9 @@ pub struct FromFn<F> { | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| impl<F> FromFn<F> { | ||||||||||||||||||||||
| /// Construct middleware from the provided asynchronous function. | ||||||||||||||||||||||
| pub fn new(f: F) -> Self { Self { f } } | ||||||||||||||||||||||
| pub fn new(f: F) -> Self { | ||||||||||||||||||||||
| Self { f } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Convenience constructor to build middleware from an async function. | ||||||||||||||||||||||
|
|
@@ -202,7 +230,9 @@ impl<F> FromFn<F> { | |||||||||||||||||||||
| /// # } | ||||||||||||||||||||||
| /// let mw = from_fn(logging); | ||||||||||||||||||||||
| /// ``` | ||||||||||||||||||||||
| pub fn from_fn<F>(f: F) -> FromFn<F> { FromFn::new(f) } | ||||||||||||||||||||||
| pub fn from_fn<F>(f: F) -> FromFn<F> { | ||||||||||||||||||||||
| FromFn::new(f) | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Service wrapper that applies a middleware function to requests. | ||||||||||||||||||||||
| /// | ||||||||||||||||||||||
|
|
@@ -283,7 +313,9 @@ impl<E: Packet> HandlerService<E> { | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// Returns the route identifier associated with this service. | ||||||||||||||||||||||
| #[must_use] | ||||||||||||||||||||||
| pub const fn id(&self) -> u32 { self.id } | ||||||||||||||||||||||
| pub const fn id(&self) -> u32 { | ||||||||||||||||||||||
| self.id | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| struct RouteService<E: Packet> { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace
#[allow]with#[expect]to comply with coding guidelines.The coding guidelines explicitly forbid
#[allow]directives. Use#[expect]instead with the same reason.Apply this diff to fix the compliance issue:
📝 Committable suggestion
🤖 Prompt for AI Agents