add rust formatting rules
This commit is contained in:
parent
8dd059871a
commit
ecad886ed9
7 changed files with 32 additions and 15 deletions
|
@ -1,8 +1,8 @@
|
||||||
pub mod ctx;
|
pub mod ctx;
|
||||||
use ctx::WgpuCtx;
|
|
||||||
|
|
||||||
use log::{debug, trace};
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use ctx::WgpuCtx;
|
||||||
|
use log::{debug, trace};
|
||||||
use winit::application::ApplicationHandler;
|
use winit::application::ApplicationHandler;
|
||||||
use winit::event::WindowEvent;
|
use winit::event::WindowEvent;
|
||||||
use winit::event_loop::ActiveEventLoop;
|
use winit::event_loop::ActiveEventLoop;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use super::COMMAND_LIST;
|
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
|
use super::COMMAND_LIST;
|
||||||
|
|
||||||
pub(crate) fn say_hello() {
|
pub(crate) fn say_hello() {
|
||||||
println!("Hello, World!");
|
println!("Hello, World!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
pub mod commands;
|
pub mod commands;
|
||||||
pub mod repl;
|
pub mod repl;
|
||||||
|
|
||||||
|
use std::{borrow::Borrow, collections::HashMap, sync::Arc};
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use log::{debug, info};
|
use log::{debug, info};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use std::{borrow::Borrow, collections::HashMap, sync::Arc};
|
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref COMMAND_LIST: Arc<CommandList> = Arc::new(CommandList::new());
|
pub static ref COMMAND_LIST: Arc<CommandList> = Arc::new(CommandList::new());
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use crate::{
|
use std::{
|
||||||
core::repl::{commands, Callable, COMMAND_LIST},
|
borrow::Cow::{self, Borrowed, Owned},
|
||||||
utils::logger::LOGGER,
|
sync::{Arc, Mutex},
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
|
@ -12,9 +13,10 @@ use rustyline::{
|
||||||
Cmd, Completer, ConditionalEventHandler, Editor, Event, EventContext, EventHandler, Helper,
|
Cmd, Completer, ConditionalEventHandler, Editor, Event, EventContext, EventHandler, Helper,
|
||||||
Hinter, KeyEvent, RepeatCount, Validator,
|
Hinter, KeyEvent, RepeatCount, Validator,
|
||||||
};
|
};
|
||||||
use std::{
|
|
||||||
borrow::Cow::{self, Borrowed, Owned},
|
use crate::{
|
||||||
sync::{Arc, Mutex},
|
core::repl::{commands, Callable, COMMAND_LIST},
|
||||||
|
utils::logger::LOGGER,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Completer, Helper, Hinter, Validator)]
|
#[derive(Completer, Helper, Hinter, Validator)]
|
||||||
|
@ -48,7 +50,10 @@ impl ConditionalEventHandler for BacktickEventHandler {
|
||||||
if let Some(k) = evt.get(0) {
|
if let Some(k) = evt.get(0) {
|
||||||
if *k == KeyEvent::from('`') {
|
if *k == KeyEvent::from('`') {
|
||||||
let mut state = self.toggle_state.lock().unwrap();
|
let mut state = self.toggle_state.lock().unwrap();
|
||||||
println!("Stdout Logging: {}", if *state { "ON".green() } else { "OFF".red() });
|
println!(
|
||||||
|
"Stdout Logging: {}",
|
||||||
|
if *state { "ON".green() } else { "OFF".red() }
|
||||||
|
);
|
||||||
if *state {
|
if *state {
|
||||||
LOGGER.write_to_stdout();
|
LOGGER.write_to_stdout();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
use colored::Colorize;
|
|
||||||
use log::{Level, Log, Metadata, Record};
|
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
|
use colored::Colorize;
|
||||||
|
use log::{Level, Log, Metadata, Record};
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
pub static LOGGER: Lazy<DynamicLogger> = Lazy::new(DynamicLogger::new);
|
pub static LOGGER: Lazy<DynamicLogger> = Lazy::new(DynamicLogger::new);
|
||||||
|
|
||||||
// A logger that dynamically switches between file and stdout
|
// A logger that dynamically switches between file and stdout
|
||||||
|
|
2
rust-toolchain.toml
Normal file
2
rust-toolchain.toml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[toolchain]
|
||||||
|
channel = "nightly"
|
7
rustfmt.toml
Normal file
7
rustfmt.toml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
indent_style = "Block"
|
||||||
|
wrap_comments = true
|
||||||
|
format_code_in_doc_comments = true
|
||||||
|
trailing_comma = "Vertical"
|
||||||
|
group_imports = "StdExternalCrate"
|
||||||
|
reorder_impl_items = true
|
||||||
|
unstable_features = true
|
Loading…
Add table
Add a link
Reference in a new issue