Skip to content

Commit

Permalink
Janitorial: Enum items should only start with upper case (from Clippy).
Browse files Browse the repository at this point in the history
  • Loading branch information
randombtree committed Dec 15, 2023
1 parent b1a3fe4 commit 04a9187
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ use crate::service::{RpcService, RpcContext};
type ProxyKey = Arc<[u8; UUID_LEN]>;

enum RpcProxyState {
INIT,
PENDING(Waker),
READY(Vec<u8>),
FINISHED,
Init,
Pending(Waker),
Ready(Vec<u8>),
Finished,
}

impl RpcProxyState {
fn new() -> RpcProxyState {
RpcProxyState::INIT
RpcProxyState::Init
}
}

Expand All @@ -61,9 +61,9 @@ impl<T: Sync> RpcProxyInner<T> {
/// Set the result for the Future waiting and wake up waiter.
fn wakeup(&self, result: Vec<u8>) {
let mut state = self.state.lock().unwrap();
let mut new_state = RpcProxyState::READY(result);
let mut new_state = RpcProxyState::Ready(result);
swap(&mut *state, &mut new_state);
if let RpcProxyState::PENDING(waker) = new_state {
if let RpcProxyState::Pending(waker) = new_state {
waker.wake();
}
}
Expand All @@ -87,17 +87,17 @@ impl<T: Sync> Future for RpcProxy<T> {

// Ugh, this got a bit ugly, fix this if a match'n'swap pattern can be found
match *state {
INIT | PENDING(_) => {
swap(&mut *state, &mut RpcProxyState::PENDING(cx.waker().clone()));
Init | Pending(_) => {
swap(&mut *state, &mut RpcProxyState::Pending(cx.waker().clone()));
Poll::Pending
},
FINISHED => Poll::Pending,
READY(_) => {
Finished => Poll::Pending,
Ready(_) => {

let mut oldstate = FINISHED;
let mut oldstate = Finished;
swap(&mut *state, &mut oldstate);

if let READY(out) = oldstate {
if let Ready(out) = oldstate {
Poll::Ready(out)
} else {
Poll::Pending
Expand Down

0 comments on commit 04a9187

Please sign in to comment.