-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Better errors when emitting data #184
Conversation
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.
clippy found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
self.internal_tx.capacity() | ||
} | ||
/// Reserve n slots in the internal channel | ||
pub fn reserve<'a>(&'a self, n: u32) -> Result<Permit<'a>, TryAcquireError> { |
Check warning
Code scanning / clippy
the following explicit lifetimes could be elided: 'a Warning
self.internal_tx.capacity() | ||
} | ||
/// Reserve n slots in the internal channel | ||
pub fn reserve<'a>(&'a self, n: u32) -> Result<Permit<'a>, TryAcquireError> { |
Check warning
Code scanning / clippy
the following explicit lifetimes could be elided: 'a Warning
self.internal_tx.capacity() | ||
} | ||
/// Reserve n slots in the internal channel | ||
pub fn reserve<'a>(&'a self, n: u32) -> Result<Permit<'a>, TryAcquireError> { |
Check warning
Code scanning / clippy
the following explicit lifetimes could be elided: 'a Warning
} | ||
/// Reserve n slots in the internal channel | ||
pub fn reserve<'a>(&'a self, n: u32) -> Result<Permit<'a>, TryAcquireError> { | ||
Ok(Permit::new(&self.internal_tx, &self.semaphore, n)?) |
Check warning
Code scanning / clippy
question mark operator is useless here Warning
|
||
#[cfg(feature = "v3")] | ||
let Payload { data, has_binary } = | ||
payload::encoder(rx, protocol, socket.supports_binary, max_payload).await?; | ||
payload::encoder(rx, &sem, protocol, socket.supports_binary, max_payload).await?; |
Check warning
Code scanning / clippy
this expression creates a reference which is immediately dereferenced by the compiler Warning
@@ -287,16 +287,19 @@ | |||
} | |||
|
|||
/// Send the ack response to the client. | |||
pub fn send(self, data: impl Serialize) -> Result<(), SendError> { | |||
pub fn send<T: Serialize>(self, data: T) -> Result<(), SendError<T>> { |
Check failure
Code scanning / clippy
enum takes 0 generic arguments but 1 generic argument was supplied Error
data: impl serde::Serialize, | ||
) -> Result<(), BroadcastError> { | ||
data: T, | ||
) -> Result<(), BroadcastError<T>> { |
Check failure
Code scanning / clippy
enum takes 0 generic arguments but 1 generic argument was supplied Error
) -> Result<(), SendError> { | ||
event: impl Into<String>, | ||
data: T, | ||
) -> Result<(), SendError<T>> { |
Check failure
Code scanning / clippy
enum takes 0 generic arguments but 1 generic argument was supplied Error
@@ -645,7 +644,14 @@ | |||
} | |||
} | |||
|
|||
/// Gets the request info made by the client to connect | |||
pub(crate) fn reserve(&self, n: u32) -> Result<Permit<'_>, SocketError<()>> { |
Check failure
Code scanning / clippy
enum takes 0 generic arguments but 1 generic argument was supplied Error
data: impl serde::Serialize, | ||
) -> Result<(), BroadcastError> { | ||
data: T, | ||
) -> Result<(), BroadcastError<T>> { |
Check failure
Code scanning / clippy
enum takes 0 generic arguments but 1 generic argument was supplied Error
Closed in favor of #262 |
Fix #172
Permit
API, aSemaphore
will be added to the engineSocket
. With this semaphore it will possible to theoretically "reserve" n slot without creating nPermit
s.