mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-13 06:20:02 -04:00
fix builds without a config format & twisp
This commit is contained in:
parent
80c91c9381
commit
23b96c2073
2 changed files with 19 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
use std::{collections::HashMap, ops::RangeInclusive, path::PathBuf};
|
use std::{collections::HashMap, ops::RangeInclusive, path::PathBuf};
|
||||||
|
|
||||||
|
use cfg_if::cfg_if;
|
||||||
use clap::{Parser, ValueEnum};
|
use clap::{Parser, ValueEnum};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
|
@ -353,10 +354,9 @@ impl Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Default, ValueEnum)]
|
#[derive(Clone, Copy, Eq, PartialEq, PartialOrd, Ord, ValueEnum)]
|
||||||
pub enum ConfigFormat {
|
pub enum ConfigFormat {
|
||||||
#[cfg(feature = "toml")]
|
#[cfg(feature = "toml")]
|
||||||
#[default]
|
|
||||||
Toml,
|
Toml,
|
||||||
#[cfg(feature = "json")]
|
#[cfg(feature = "json")]
|
||||||
Json,
|
Json,
|
||||||
|
@ -364,6 +364,22 @@ pub enum ConfigFormat {
|
||||||
Yaml,
|
Yaml,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ConfigFormat {
|
||||||
|
fn default() -> Self {
|
||||||
|
cfg_if! {
|
||||||
|
if #[cfg(feature = "toml")] {
|
||||||
|
return Self::Toml;
|
||||||
|
} else if #[cfg(feature = "json")] {
|
||||||
|
return Self::Json;
|
||||||
|
} else if #[cfg(feature = "yaml")] {
|
||||||
|
return Self::Yaml;
|
||||||
|
} else {
|
||||||
|
compile_error!("no config format feature enabled - build will fail!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Performant server implementation of the Wisp protocol in Rust, made for epoxy.
|
/// Performant server implementation of the Wisp protocol in Rust, made for epoxy.
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(version = clap::crate_version!())]
|
#[command(version = clap::crate_version!())]
|
||||||
|
|
|
@ -103,7 +103,7 @@ fn set_term_size(fd: RawFd, size: Size) -> anyhow::Result<()> {
|
||||||
let size = libc::winsize::from(size);
|
let size = libc::winsize::from(size);
|
||||||
let ret = unsafe { libc::ioctl(fd, libc::TIOCSWINSZ, std::ptr::addr_of!(size)) };
|
let ret = unsafe { libc::ioctl(fd, libc::TIOCSWINSZ, std::ptr::addr_of!(size)) };
|
||||||
if ret == -1 {
|
if ret == -1 {
|
||||||
Err(rustix::io::Errno::from_raw_os_error(
|
Err(nix::errno::Errno::from_raw(
|
||||||
std::io::Error::last_os_error().raw_os_error().unwrap_or(0),
|
std::io::Error::last_os_error().raw_os_error().unwrap_or(0),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue