Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 80b9150

Browse files
committed
Use a u32 rather than u64 because we have to support power pc.
And who will ever need more than 32 bits, anyway?
1 parent 7029815 commit 80b9150

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/cmd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ impl server::Output for PrintlnOutput {
193193
println!("{}", output);
194194
}
195195

196-
fn provide_id(&self) -> u64 {
196+
fn provide_id(&self) -> u32 {
197197
0
198198
}
199199

src/lsp_data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,13 @@ pub struct RequestMessage<T>
200200
where T: Debug + Serialize
201201
{
202202
jsonrpc: &'static str,
203-
pub id: u64,
203+
pub id: u32,
204204
pub method: String,
205205
pub params: T,
206206
}
207207

208208
impl <T> RequestMessage<T> where T: Debug + Serialize {
209-
pub fn new(id: u64, method: String, params: T) -> Self {
209+
pub fn new(id: u32, method: String, params: T) -> Self {
210210
RequestMessage {
211211
jsonrpc: "2.0",
212212
id,

src/server.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use actions::ActionHandler;
1818
use std::fmt;
1919
use std::io::{self, Read, Write, ErrorKind};
2020
use std::sync::Arc;
21-
use std::sync::atomic::{AtomicBool, Ordering, AtomicU64};
21+
use std::sync::atomic::{AtomicBool, Ordering, AtomicU32};
2222
use std::path::PathBuf;
2323

2424
#[cfg(test)]
@@ -547,7 +547,7 @@ impl MessageReader for StdioMsgReader {
547547

548548
pub trait Output: Sync + Send + Clone + 'static {
549549
fn response(&self, output: String);
550-
fn provide_id(&self) -> u64;
550+
fn provide_id(&self) -> u32;
551551

552552
fn parse_error(&self) {
553553
self.response(r#"{"jsonrpc": "2.0", "error": {"code": -32700, "message": "Parse error"}, "id": null}"#.to_owned());
@@ -603,13 +603,13 @@ pub trait Output: Sync + Send + Clone + 'static {
603603

604604
#[derive(Clone)]
605605
struct StdioOutput {
606-
next_id: Arc<AtomicU64>,
606+
next_id: Arc<AtomicU32>,
607607
}
608608

609609
impl StdioOutput {
610610
pub fn new() -> StdioOutput {
611611
StdioOutput {
612-
next_id: Arc::new(AtomicU64::new(1)),
612+
next_id: Arc::new(AtomicU32::new(1)),
613613
}
614614
}
615615
}
@@ -624,7 +624,7 @@ impl Output for StdioOutput {
624624
io::stdout().flush().unwrap();
625625
}
626626

627-
fn provide_id(&self) -> u64 {
627+
fn provide_id(&self) -> u32 {
628628
self.next_id.fetch_add(1, Ordering::SeqCst)
629629
}
630630
}

src/test/harness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl ls_server::Output for RecordOutput {
9090
records.push(output);
9191
}
9292

93-
fn provide_id(&self) -> u64 {
93+
fn provide_id(&self) -> u32 {
9494
0
9595
}
9696
}

0 commit comments

Comments
 (0)