Resolve warnings
This commit is contained in:
parent
dfdeae5638
commit
b715c4ad06
18 changed files with 48 additions and 35 deletions
|
|
@ -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};
|
||||
|
||||
|
|
|
|||
19
factorio-blueprint/src/bin/decode_base64.rs
Normal file
19
factorio-blueprint/src/bin/decode_base64.rs
Normal 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);
|
||||
}
|
||||
|
|
@ -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::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use bon::Builder;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue