Resolve warnings

This commit is contained in:
hal8174 2025-01-18 22:47:48 +01:00
parent dfdeae5638
commit b715c4ad06
18 changed files with 48 additions and 35 deletions

View file

@ -1,6 +1,4 @@
use factorio_core::{pathfield::PathField, prelude::*};
use crate::misc::Beltspeed;
use factorio_core::{beltoptions::Beltspeed, pathfield::PathField, prelude::*};
use super::{BlueprintEntity, BlueprintPosition};

View file

@ -0,0 +1,19 @@
use std::io::{Cursor, Read};
use base64::{Engine, prelude::BASE64_STANDARD};
fn main() {
let i = std::fs::read_to_string("test").unwrap();
let u = BASE64_STANDARD.decode(i.trim().as_bytes()).unwrap();
dbg!(&u);
let mut o = String::new();
flate2::bufread::ZlibDecoder::new(Cursor::new(u))
.read_to_string(&mut o)
.unwrap();
dbg!(o);
}

View file

@ -4,10 +4,8 @@ use base64::prelude::BASE64_STANDARD;
use std::io::Cursor;
use std::io::Read;
pub mod misc;
pub mod structs;
pub mod belt;
pub mod structs;
pub use structs::*;

View file

@ -1,82 +0,0 @@
use clap::ValueEnum;
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
pub enum Beltspeed {
Normal,
Fast,
Express,
Turbo,
}
impl Beltspeed {
pub fn string(self) -> String {
match self {
Beltspeed::Normal => "transport-belt",
Beltspeed::Fast => "fast-transport-belt",
Beltspeed::Express => "express-transport-belt",
Beltspeed::Turbo => "turbo-transport-belt",
}
.to_owned()
}
pub fn string_underground(self) -> String {
match self {
Beltspeed::Normal => "underground-belt",
Beltspeed::Fast => "fast-underground-belt",
Beltspeed::Express => "express-underground-belt",
Beltspeed::Turbo => "turbo-underground-belt",
}
.to_owned()
}
pub fn string_splitter(self) -> String {
match self {
Beltspeed::Normal => "splitter",
Beltspeed::Fast => "fast-splitter",
Beltspeed::Express => "express-splitter",
Beltspeed::Turbo => "turbo-splitter",
}
.to_owned()
}
pub fn halve(self) -> Self {
match self {
Beltspeed::Normal => Beltspeed::Normal,
Beltspeed::Fast => Beltspeed::Normal,
Beltspeed::Express => Beltspeed::Fast,
Beltspeed::Turbo => Beltspeed::Fast,
}
}
pub fn halvings(self, i: usize) -> Self {
let mut s = self;
for _ in 0..i {
s = s.halve();
}
s
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
pub enum Belttype {
Full,
Left,
Right,
}
impl Belttype {
pub fn contains_left(self) -> bool {
match self {
Belttype::Full => true,
Belttype::Left => true,
Belttype::Right => false,
}
}
pub fn contains_right(self) -> bool {
match self {
Belttype::Full => true,
Belttype::Left => false,
Belttype::Right => true,
}
}
}

View file

@ -1,5 +1,3 @@
use std::collections::HashMap;
use bon::Builder;
use serde::Deserialize;
use serde::Serialize;