From 72ed5ef3fa8bb4edc1691fd5ad2fe93a99b5a533 Mon Sep 17 00:00:00 2001 From: YoEnte Date: Mon, 15 Sep 2025 15:13:03 +0200 Subject: [PATCH] chore: make python-only functions not public --- src/plugin2026/board.rs | 11 +++++------ src/plugin2026/field_type.rs | 8 ++++---- src/plugin2026/game_state.rs | 11 +++++------ src/plugin2026/move.rs | 11 +++++------ src/plugin2026/utils/coordinate.rs | 12 ++++++------ src/plugin2026/utils/direction.rs | 11 +++++------ src/plugin2026/utils/team.rs | 8 ++++---- src/plugin2026/utils/vector.rs | 11 +++++------ 8 files changed, 39 insertions(+), 44 deletions(-) diff --git a/src/plugin2026/board.rs b/src/plugin2026/board.rs index 3a589fb..e0846f5 100644 --- a/src/plugin2026/board.rs +++ b/src/plugin2026/board.rs @@ -23,12 +23,11 @@ impl Board { Self { map } } - pub fn __str__(&self) -> String {self.to_string()} - pub fn __repr__(&self) -> String {format!("{:?}", self)} - pub fn __eq__(&self, other: &Board) -> bool {self == other} - pub fn __ne_(&self, other: &Board) -> bool {self != other} - - pub fn deepcopy(&self) -> Board {self.clone()} + fn __str__(&self) -> String {self.to_string()} + fn __repr__(&self) -> String {format!("{:?}", self)} + fn __eq__(&self, other: &Board) -> bool {self == other} + fn __ne__(&self, other: &Board) -> bool {self != other} + fn deepcopy(&self) -> Board {self.clone()} pub fn get_field(&self, position: &Coordinate) -> Option { diff --git a/src/plugin2026/field_type.rs b/src/plugin2026/field_type.rs index 022aa81..d9bc525 100644 --- a/src/plugin2026/field_type.rs +++ b/src/plugin2026/field_type.rs @@ -17,10 +17,10 @@ pub enum FieldType { #[pymethods] impl FieldType { - pub fn __str__(&self) -> String {self.to_string()} - pub fn __repr__(&self) -> String {format!("{:?}", self)} - pub fn __eq__(&self, other: &FieldType) -> bool {self == other} - pub fn __ne_(&self, other: &FieldType) -> bool {self != other} + fn __str__(&self) -> String {self.to_string()} + fn __repr__(&self) -> String {format!("{:?}", self)} + fn __eq__(&self, other: &FieldType) -> bool {self == other} + fn __ne__(&self, other: &FieldType) -> bool {self != other} pub fn get_value(&self) -> usize { match self { diff --git a/src/plugin2026/game_state.rs b/src/plugin2026/game_state.rs index 6b5be58..1b2bc0a 100644 --- a/src/plugin2026/game_state.rs +++ b/src/plugin2026/game_state.rs @@ -29,12 +29,11 @@ impl GameState { } } - pub fn __str__(&self) -> String {self.to_string()} - pub fn __repr__(&self) -> String {format!("{:?}", self)} - pub fn __eq__(&self, other: &GameState) -> bool {self == other} - pub fn __ne__(&self, other: &GameState) -> bool {self != other} - - pub fn deepcopy(&self) -> GameState {self.clone()} + fn __str__(&self) -> String {self.to_string()} + fn __repr__(&self) -> String {format!("{:?}", self)} + fn __eq__(&self, other: &GameState) -> bool {self == other} + fn __ne__(&self, other: &GameState) -> bool {self != other} + fn deepcopy(&self) -> GameState {self.clone()} pub fn set_board_field(&mut self, position: &Coordinate, field: FieldType) -> Result<(), PyErr> { let x = position.x as usize; diff --git a/src/plugin2026/move.rs b/src/plugin2026/move.rs index 4079a28..8618753 100644 --- a/src/plugin2026/move.rs +++ b/src/plugin2026/move.rs @@ -27,12 +27,11 @@ impl Move { } } - pub fn __str__(&self) -> String {self.to_string()} - pub fn __repr__(&self) -> String {format!("{:?}", self)} - pub fn __eq__(&self, other: &Move) -> bool {self == other} - pub fn __ne_(&self, other: &Move) -> bool {self != other} - - pub fn deepcopy(&self) -> Move {self.clone()} + fn __str__(&self) -> String {self.to_string()} + fn __repr__(&self) -> String {format!("{:?}", self)} + fn __eq__(&self, other: &Move) -> bool {self == other} + fn __ne__(&self, other: &Move) -> bool {self != other} + fn deepcopy(&self) -> Move {self.clone()} } impl std::fmt::Display for Move { diff --git a/src/plugin2026/utils/coordinate.rs b/src/plugin2026/utils/coordinate.rs index 0f86dab..02af65d 100644 --- a/src/plugin2026/utils/coordinate.rs +++ b/src/plugin2026/utils/coordinate.rs @@ -20,12 +20,11 @@ impl Coordinate { } } - pub fn __str__(&self) -> String {self.to_string()} - pub fn __repr__(&self) -> String {format!("{:?}", self)} - pub fn __eq__(&self, other: &Coordinate) -> bool {self == other} - pub fn __ne_(&self, other: &Coordinate) -> bool {self != other} - - pub fn deepcopy(&self) -> Coordinate {*self} + fn __str__(&self) -> String {self.to_string()} + fn __repr__(&self) -> String {format!("{:?}", self)} + fn __eq__(&self, other: &Coordinate) -> bool {self == other} + fn __ne__(&self, other: &Coordinate) -> bool {self != other} + fn deepcopy(&self) -> Coordinate {*self} pub fn add_vector(&self, vector: &Vector) -> Coordinate { Coordinate { @@ -35,6 +34,7 @@ impl Coordinate { } pub fn add_vector_mut(&mut self, vector: &Vector) { + self.x += vector.delta_x; self.y += vector.delta_y; } diff --git a/src/plugin2026/utils/direction.rs b/src/plugin2026/utils/direction.rs index f6faca5..d127039 100644 --- a/src/plugin2026/utils/direction.rs +++ b/src/plugin2026/utils/direction.rs @@ -19,12 +19,11 @@ pub enum Direction { #[pymethods] impl Direction { - pub fn __str__(&self) -> String {self.to_string()} - pub fn __repr__(&self) -> String {format!("{:?}", self)} - pub fn __eq__(&self, other: &Direction) -> bool {self == other} - pub fn __ne_(&self, other: &Direction) -> bool {self != other} - - pub fn deepcopy(&self) -> Direction {*self} + fn __str__(&self) -> String {self.to_string()} + fn __repr__(&self) -> String {format!("{:?}", self)} + fn __eq__(&self, other: &Direction) -> bool {self == other} + fn __ne__(&self, other: &Direction) -> bool {self != other} + fn deepcopy(&self) -> Direction {*self} #[staticmethod] pub fn from_vector(vector: &Vector) -> Option { diff --git a/src/plugin2026/utils/team.rs b/src/plugin2026/utils/team.rs index ad3dc08..078c842 100644 --- a/src/plugin2026/utils/team.rs +++ b/src/plugin2026/utils/team.rs @@ -11,10 +11,10 @@ pub enum TeamEnum { #[pymethods] impl TeamEnum { - pub fn __str__(&self) -> String {self.to_string()} - pub fn __repr__(&self) -> String {format!("{:?}", self)} - pub fn __eq__(&self, other: &TeamEnum) -> bool {self == other} - pub fn __ne_(&self, other: &TeamEnum) -> bool {self != other} + fn __str__(&self) -> String {self.to_string()} + fn __repr__(&self) -> String {format!("{:?}", self)} + fn __eq__(&self, other: &TeamEnum) -> bool {self == other} + fn __ne__(&self, other: &TeamEnum) -> bool {self != other} pub fn get_fish_types(&self) -> Vec { match self { diff --git a/src/plugin2026/utils/vector.rs b/src/plugin2026/utils/vector.rs index 3e16245..8b0b4af 100644 --- a/src/plugin2026/utils/vector.rs +++ b/src/plugin2026/utils/vector.rs @@ -18,12 +18,11 @@ impl Vector { } } - pub fn __str__(&self) -> String {self.to_string()} - pub fn __repr__(&self) -> String {format!("{:?}", self)} - pub fn __eq__(&self, other: &Vector) -> bool {self == other} - pub fn __ne_(&self, other: &Vector) -> bool {self != other} - - pub fn deepcopy(&self) -> Vector {*self} + fn __str__(&self) -> String {self.to_string()} + fn __repr__(&self) -> String {format!("{:?}", self)} + fn __eq__(&self, other: &Vector) -> bool {self == other} + fn __ne__(&self, other: &Vector) -> bool {self != other} + fn deepcopy(&self) -> Vector {*self} pub fn add_vector(&self, other: &Vector) -> Vector { Vector {