edited the rustfmt.toml
unstable features are commented out
Dieser Commit ist enthalten in:
Ursprung
b683e45aff
Commit
5129d46b35
9 geänderte Dateien mit 74 neuen und 17 gelöschten Zeilen
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@ CARGO_OPTS:=-q
|
||||||
TARGET_DIR:=debug
|
TARGET_DIR:=debug
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
@$(CARGO) fmt 2>/dev/null
|
@$(CARGO) fmt
|
||||||
|
|
||||||
%: fmt
|
%: fmt
|
||||||
@$(CARGO) build $(CARGO_OPTS) --bin $@
|
@$(CARGO) build $(CARGO_OPTS) --bin $@
|
||||||
|
|
|
@ -22,7 +22,11 @@ struct IncludeData {
|
||||||
|
|
||||||
impl Default for IncludeData {
|
impl Default for IncludeData {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
IncludeData { var: VAR_NAME.into(), year: None, day: None }
|
IncludeData {
|
||||||
|
var: VAR_NAME.into(),
|
||||||
|
year: None,
|
||||||
|
day: None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
rustfmt.toml
21
rustfmt.toml
|
@ -1,13 +1,26 @@
|
||||||
#binop_separator= "Back"
|
|
||||||
#brace_style="SameLineWhere"
|
|
||||||
#force_multiline_blocks = true
|
|
||||||
#imports_layout = "Vertical"
|
|
||||||
array_width = 0
|
array_width = 0
|
||||||
attr_fn_like_width = 80
|
attr_fn_like_width = 80
|
||||||
|
#binop_separator = "Back"
|
||||||
|
#blank_lines_lower_bound = 1
|
||||||
|
#blank_lines_upper_bound = 2
|
||||||
|
#brace_style = "SameLineWhere"
|
||||||
chain_width = 144
|
chain_width = 144
|
||||||
|
#combine_control_expr = false
|
||||||
|
#comment_width = 240
|
||||||
|
#condense_wildcard_suffixes = true
|
||||||
|
#empty_item_single_line = true
|
||||||
|
#enum_discrim_align_threshold = 20
|
||||||
fn_params_layout = "Tall"
|
fn_params_layout = "Tall"
|
||||||
force_explicit_abi = true
|
force_explicit_abi = true
|
||||||
|
#force_multiline_blocks = true
|
||||||
|
#format_code_in_doc_comments = true
|
||||||
|
#format_macro_bodies = true
|
||||||
hard_tabs = false
|
hard_tabs = false
|
||||||
|
#hex_literal_case = "Upper"
|
||||||
|
#imports_granularity = "Crate"
|
||||||
|
#imports_layout = "Vertical"
|
||||||
|
#indent_style = "Block"
|
||||||
|
#inline_attribute_width = 0
|
||||||
match_block_trailing_comma = true
|
match_block_trailing_comma = true
|
||||||
max_width = 240
|
max_width = 240
|
||||||
merge_derives = true
|
merge_derives = true
|
||||||
|
|
|
@ -53,7 +53,11 @@ impl<T: Integer + SubAssign> SubAssign for Euclidian<T> {
|
||||||
|
|
||||||
impl<T: Integer> Euclidian<T> {
|
impl<T: Integer> Euclidian<T> {
|
||||||
pub const fn new(x: T, y: T, z: T) -> Self {
|
pub const fn new(x: T, y: T, z: T) -> Self {
|
||||||
Self { x: x, y: y, z: z }
|
Self {
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +65,10 @@ impl<T: Integer> Euclidian<T> {
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
fn test() {
|
fn test() {
|
||||||
Euclidian { x: 0, y: 0, z: 0 };
|
Euclidian {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,12 @@ impl KartesianDirection {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter(none: bool, diagonal: bool, straight: bool) -> KartesianIterator {
|
pub fn iter(none: bool, diagonal: bool, straight: bool) -> KartesianIterator {
|
||||||
KartesianIterator { i: 0, none, diagonal, straight }
|
KartesianIterator {
|
||||||
|
i: 0,
|
||||||
|
none,
|
||||||
|
diagonal,
|
||||||
|
straight,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,10 @@ use std::{fmt::Display, ops::*};
|
||||||
|
|
||||||
impl<T: Integer> Add for Kartesian<T> {
|
impl<T: Integer> Add for Kartesian<T> {
|
||||||
fn add(self, rhs: Self) -> Self::Output {
|
fn add(self, rhs: Self) -> Self::Output {
|
||||||
Kartesian { x: self.x + rhs.x, y: self.y + rhs.y }
|
Kartesian {
|
||||||
|
x: self.x + rhs.x,
|
||||||
|
y: self.y + rhs.y,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Output = Kartesian<T>;
|
type Output = Kartesian<T>;
|
||||||
|
@ -20,7 +23,10 @@ impl<T: Integer + AddAssign> AddAssign for Kartesian<T> {
|
||||||
|
|
||||||
impl<T: Integer> Sub for Kartesian<T> {
|
impl<T: Integer> Sub for Kartesian<T> {
|
||||||
fn sub(self, rhs: Self) -> Self::Output {
|
fn sub(self, rhs: Self) -> Self::Output {
|
||||||
Kartesian { x: self.x - rhs.x, y: self.y - rhs.y }
|
Kartesian {
|
||||||
|
x: self.x - rhs.x,
|
||||||
|
y: self.y - rhs.y,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Output = Kartesian<T>;
|
type Output = Kartesian<T>;
|
||||||
|
@ -52,7 +58,10 @@ impl<T: Integer + Copy> Div<T> for Kartesian<T> {
|
||||||
impl<T: Integer + Rem> Rem for Kartesian<T> {
|
impl<T: Integer + Rem> Rem for Kartesian<T> {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
fn rem(self, rhs: Self) -> Self {
|
fn rem(self, rhs: Self) -> Self {
|
||||||
Kartesian { x: self.x % rhs.x, y: self.y % rhs.y }
|
Kartesian {
|
||||||
|
x: self.x % rhs.x,
|
||||||
|
y: self.y % rhs.y,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<T: Integer + RemAssign> RemAssign for Kartesian<T> {
|
impl<T: Integer + RemAssign> RemAssign for Kartesian<T> {
|
||||||
|
|
|
@ -25,6 +25,9 @@ impl_maximum!(u128);
|
||||||
|
|
||||||
impl MaximumFromMap<usize> for Kartesian<usize> {
|
impl MaximumFromMap<usize> for Kartesian<usize> {
|
||||||
fn maximum<U>(map: &Vec<Vec<U>>) -> Kartesian<usize> {
|
fn maximum<U>(map: &Vec<Vec<U>>) -> Kartesian<usize> {
|
||||||
Kartesian { x: map.len(), y: map[0].len() }
|
Kartesian {
|
||||||
|
x: map.len(),
|
||||||
|
y: map[0].len(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,10 @@ where
|
||||||
|
|
||||||
impl<T: Integer> Kartesian<T> {
|
impl<T: Integer> Kartesian<T> {
|
||||||
pub const fn new(x: T, y: T) -> Self {
|
pub const fn new(x: T, y: T) -> Self {
|
||||||
Self { x: x, y: y }
|
Self {
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,6 +251,12 @@ pub struct Velocity<T: Integer + Unsigned> {
|
||||||
|
|
||||||
impl<T: Integer + Unsigned> Velocity<T> {
|
impl<T: Integer + Unsigned> Velocity<T> {
|
||||||
pub fn new(x: T, y: T, dir: KartesianDirection) -> Self {
|
pub fn new(x: T, y: T, dir: KartesianDirection) -> Self {
|
||||||
Velocity { speed: Kartesian { x, y }, direction: dir }
|
Velocity {
|
||||||
|
speed: Kartesian {
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
},
|
||||||
|
direction: dir,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,10 @@ macro_rules! to_coords_impl {
|
||||||
($subtype:ident) => {
|
($subtype:ident) => {
|
||||||
impl ToCoords for Kartesian<$subtype> {
|
impl ToCoords for Kartesian<$subtype> {
|
||||||
fn to_coords(self) -> Kartesian<usize> {
|
fn to_coords(self) -> Kartesian<usize> {
|
||||||
Kartesian { x: self.x as usize, y: self.y as usize }
|
Kartesian {
|
||||||
|
x: self.x as usize,
|
||||||
|
y: self.y as usize,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -60,6 +63,9 @@ to_coords_impl!(u128);
|
||||||
|
|
||||||
impl ToCoords for Kartesian<usize> {
|
impl ToCoords for Kartesian<usize> {
|
||||||
fn to_coords(self) -> Kartesian<usize> {
|
fn to_coords(self) -> Kartesian<usize> {
|
||||||
Kartesian { x: self.x, y: self.y }
|
Kartesian {
|
||||||
|
x: self.x,
|
||||||
|
y: self.y,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Laden …
Tabelle hinzufügen
In neuem Issue referenzieren