Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/proc-macro-srv-cli/src/main.rs')
| -rw-r--r-- | crates/proc-macro-srv-cli/src/main.rs | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/crates/proc-macro-srv-cli/src/main.rs b/crates/proc-macro-srv-cli/src/main.rs index 662d34865e..bdfdb50002 100644 --- a/crates/proc-macro-srv-cli/src/main.rs +++ b/crates/proc-macro-srv-cli/src/main.rs @@ -9,10 +9,10 @@ extern crate rustc_driver as _; mod version; -#[cfg(any(feature = "sysroot-abi", rust_analyzer))] +#[cfg(feature = "sysroot-abi")] mod main_loop; use clap::{Command, ValueEnum}; -#[cfg(any(feature = "sysroot-abi", rust_analyzer))] +#[cfg(feature = "sysroot-abi")] use main_loop::run; fn main() -> std::io::Result<()> { @@ -31,7 +31,7 @@ fn main() -> std::io::Result<()> { clap::Arg::new("format") .long("format") .action(clap::ArgAction::Set) - .default_value("json") + .default_value("json-legacy") .value_parser(clap::builder::EnumValueParser::<ProtocolFormat>::new()), clap::Arg::new("version") .long("version") @@ -50,34 +50,44 @@ fn main() -> std::io::Result<()> { #[derive(Copy, Clone)] enum ProtocolFormat { - Json, - #[cfg(feature = "postcard")] - Postcard, + JsonLegacy, + PostcardLegacy, + BidirectionalPostcardPrototype, } impl ValueEnum for ProtocolFormat { fn value_variants<'a>() -> &'a [Self] { - &[ProtocolFormat::Json] + &[ + ProtocolFormat::JsonLegacy, + ProtocolFormat::PostcardLegacy, + ProtocolFormat::BidirectionalPostcardPrototype, + ] } fn to_possible_value(&self) -> Option<clap::builder::PossibleValue> { match self { - ProtocolFormat::Json => Some(clap::builder::PossibleValue::new("json")), - #[cfg(feature = "postcard")] - ProtocolFormat::Postcard => Some(clap::builder::PossibleValue::new("postcard")), + ProtocolFormat::JsonLegacy => Some(clap::builder::PossibleValue::new("json-legacy")), + ProtocolFormat::PostcardLegacy => { + Some(clap::builder::PossibleValue::new("postcard-legacy")) + } + ProtocolFormat::BidirectionalPostcardPrototype => { + Some(clap::builder::PossibleValue::new("bidirectional-postcard-prototype")) + } } } fn from_str(input: &str, _ignore_case: bool) -> Result<Self, String> { match input { - "json" => Ok(ProtocolFormat::Json), - #[cfg(feature = "postcard")] - "postcard" => Ok(ProtocolFormat::Postcard), + "json-legacy" => Ok(ProtocolFormat::JsonLegacy), + "postcard-legacy" => Ok(ProtocolFormat::PostcardLegacy), + "bidirectional-postcard-prototype" => { + Ok(ProtocolFormat::BidirectionalPostcardPrototype) + } _ => Err(format!("unknown protocol format: {input}")), } } } -#[cfg(not(any(feature = "sysroot-abi", rust_analyzer)))] +#[cfg(not(feature = "sysroot-abi"))] fn run(_: ProtocolFormat) -> std::io::Result<()> { Err(std::io::Error::new( std::io::ErrorKind::Unsupported, |