Skip to content

Commit

Permalink
fix: 🚚 batch renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Jisu-Woniu committed Jul 26, 2024
1 parent e7e83d7 commit 39ada94
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions crates/rsjudge-amqp/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use rsjudge_traits::ServiceConfig;

#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RabbitMqConfig {
pub struct AmqpConfig {
pub uri: String,
}

#[cfg(feature = "serde")]
impl ServiceConfig for RabbitMqConfig {}
impl ServiceConfig for AmqpConfig {}
4 changes: 2 additions & 2 deletions crates/rsjudge-amqp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use amqprs::{
connection::{Connection, OpenConnectionArguments},
};

use crate::config::RabbitMqConfig;
use crate::config::AmqpConfig;
pub use crate::error::{Error, Result};

pub mod config;
mod error;

pub async fn register(config: RabbitMqConfig) -> Result<()> {
pub async fn register(config: AmqpConfig) -> Result<()> {
// Build arguments for new connection.
let args = OpenConnectionArguments::try_from(&*config.uri)?;
let connection = Connection::open(&args).await?;
Expand Down
3 changes: 3 additions & 0 deletions crates/rsjudge-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ anyhow = "1.0.86"

[build-dependencies]
rustversion = "1.0.17"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(setgroups)'] }
16 changes: 8 additions & 8 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

use std::collections::HashMap;

#[cfg(feature = "amqp")]
use rsjudge_amqp::config::AmqpConfig;
#[cfg(feature = "grpc")]
use rsjudge_grpc::config::GrpcConfig;
#[cfg(feature = "rabbitmq")]
use rsjudge_rabbitmq::config::RabbitMqConfig;
#[cfg(feature = "rest")]
use rsjudge_rest::config::RestConfig;
use rsjudge_traits::language::config::LanguageDef;
Expand All @@ -21,8 +21,8 @@ pub struct Config {
pub struct Services {
#[cfg(feature = "grpc")]
pub grpc: GrpcConfig,
#[cfg(feature = "rabbitmq")]
pub rabbitmq: RabbitMqConfig,
#[cfg(feature = "amqp")]
pub amqp: AmqpConfig,
#[cfg(feature = "rest")]
pub rest: RestConfig,
}
Expand All @@ -32,10 +32,10 @@ mod tests {
#[cfg(any(feature = "grpc", feature = "rest"))]
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};

#[cfg(feature = "amqp")]
use rsjudge_amqp::config::AmqpConfig;
#[cfg(feature = "grpc")]
use rsjudge_grpc::config::GrpcConfig;
#[cfg(feature = "rabbitmq")]
use rsjudge_rabbitmq::config::RabbitMqConfig;
#[cfg(feature = "rest")]
use rsjudge_rest::config::RestConfig;

Expand All @@ -60,8 +60,8 @@ mod tests {
SocketAddr::V6(SocketAddrV6::new(Ipv6Addr::UNSPECIFIED, 80, 0, 0))
]
},
#[cfg(feature = "rabbitmq")]
rabbitmq: RabbitMqConfig {
#[cfg(feature = "amqp")]
amqp: AmqpConfig {
uri: "amqp://user:bitnami@localhost".to_owned()
},
})?
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod config;

/// # Errors
///
pub async fn main_impl() -> anyhow::Result<()> {
pub async fn async_main() -> anyhow::Result<()> {
env_logger::Builder::from_env(
Env::new()
.filter_or("RSJUDGE_LOG", "info")
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use log::error;
#[cfg(feature = "mimalloc")]
use mimalloc::MiMalloc;
use rsjudge::main_impl;
use rsjudge::async_main;

#[cfg(feature = "mimalloc")]
#[global_allocator]
Expand All @@ -15,7 +15,7 @@ mod cli;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
if let Err(err) = main_impl().await {
if let Err(err) = async_main().await {
error!("{:?}", err);
}
Ok(())
Expand Down

0 comments on commit 39ada94

Please sign in to comment.