Language Migration #21
+1
-1
@@ -62,7 +62,7 @@ fn main() {
|
||||
println!("Argument count: {}", args_len);
|
||||
|
||||
let mut act_mgr = managers::action_managers::ActionManager {
|
||||
action: String::from(""),
|
||||
action: String::new(),
|
||||
flags: Vec::new(),
|
||||
params: args,
|
||||
param_count: args_len,
|
||||
|
||||
@@ -21,21 +21,23 @@ impl Default for FileManager {
|
||||
|
||||
|
||||
impl FileManager {
|
||||
// TODO: Implement
|
||||
pub fn init(&mut self) {
|
||||
self.read_file()
|
||||
}
|
||||
// TODO: Implement
|
||||
pub fn init(&mut self) {
|
||||
self.read_file()
|
||||
}
|
||||
|
||||
pub fn save_file(&mut self, filepath: &String) {
|
||||
if !self.file_read {
|
||||
self.read_file();
|
||||
}
|
||||
|
||||
let mut file = File::open(filepath)?;
|
||||
let mut buffer = Vec::new();
|
||||
file.read_to_end(&mut buffer)?;
|
||||
let mut file = File::open(filepath)?;
|
||||
let mut buffer = Vec::new();
|
||||
file.read_to_end(&mut buffer)?;
|
||||
self.file_buffer_length = buffer.len();
|
||||
self.filebuffer = String::from_utf8(buffer); // Assuming UTF-8 encoding
|
||||
self.filebuffer = String::from_utf8(buffer); // Assuming UTF-8 encoding
|
||||
}
|
||||
|
||||
pub fn modify_file_path(&mut self, file: &String) {
|
||||
self.filepath = file;
|
||||
}
|
||||
@@ -48,12 +50,15 @@ pub fn init(&mut self) {
|
||||
self.file_buffer_length;
|
||||
}
|
||||
|
||||
fn read_file(&mut self) {
|
||||
fn read_file(&mut self) -> Vec<u8> {
|
||||
let mut file = File::open(self.filepath)?;
|
||||
let mut buffer = Vec::new();
|
||||
file.read_to_end(&mut buffer)?;
|
||||
self.file_buffer_length = buffer.len();
|
||||
self.filebuffer = String::from_utf8(buffer); // Assuming UTF-8 encoding
|
||||
self.file_read = true;
|
||||
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,13 +70,4 @@ impl TokenManager {
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
// NOTE: This can get deleted. Redundant
|
||||
fn _construct_endpoint(&self) -> String {
|
||||
let mut endpoint: String = String::from("api/");
|
||||
endpoint += &self.api.version;
|
||||
endpoint += "/login";
|
||||
|
||||
return endpoint;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -12,9 +12,9 @@ pub struct API {
|
||||
impl Default for API {
|
||||
fn default() -> Self {
|
||||
API {
|
||||
url: String::from(""),
|
||||
endpoint: String::from(""),
|
||||
version: String::from(""),
|
||||
url: String::new(),
|
||||
endpoint: String::new(),
|
||||
version: String::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::constants;
|
||||
|
||||
// use crate::constants;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Song {
|
||||
@@ -20,8 +19,6 @@ pub struct Song {
|
||||
pub track: Option<i32>,
|
||||
pub disc: Option<i32>,
|
||||
pub data: Option<Vec<u8>>,
|
||||
// use filepath instead
|
||||
// pub song_path: String,
|
||||
pub filepath: Option<String>,
|
||||
pub directory: Option<String>,
|
||||
}
|
||||
|
||||
@@ -45,29 +45,6 @@ impl Default for Upload {
|
||||
}
|
||||
|
||||
impl Upload {
|
||||
/*
|
||||
pub async fn upload_song(&self, token: &models::token::Token, song: &models::song::Song) {
|
||||
let url = self.retrieve_url();
|
||||
let client = reqwest::Client::new();
|
||||
let access_token = token.bearer_token();
|
||||
let response = client
|
||||
.post(&url)
|
||||
.header(reqwest::header::AUTHORIZATION, access_token)
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match response.status() {
|
||||
reqwest::StatusCode::OK => {
|
||||
println!("Success!");
|
||||
}
|
||||
other => {
|
||||
panic!("Issue occurred: {:?}", other);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
pub async fn upload_song_with_metadata(
|
||||
&mut self,
|
||||
token: &models::token::Token,
|
||||
|
||||
@@ -8,24 +8,6 @@ impl Checks {
|
||||
text.parse::<f64>().is_ok()
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
pub fn _item_in_container(
|
||||
_container: &Vec<String>,
|
||||
_item: &String,
|
||||
_func: fn(a: &String, b: &String) -> String,
|
||||
) -> String {
|
||||
return String::from("");
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
pub fn _item_iter_in_container(
|
||||
_container: &Vec<String>,
|
||||
_item: &String,
|
||||
_func: fn(a: &String, b: &String) -> String,
|
||||
) -> String {
|
||||
return String::from("");
|
||||
}
|
||||
|
||||
pub fn index_of_item_in_container<F>(container: &String, item: &char, func: F) -> i32
|
||||
where
|
||||
F: Fn(&char, &char) -> bool,
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct Conversions {}
|
||||
|
||||
impl Conversions {
|
||||
pub fn _to_lower_char(val: &mut char) {
|
||||
if val.is_alphabetic() {
|
||||
*val = val.to_lowercase().next().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn _initialize_values(&self) {}
|
||||
|
||||
pub fn _print_value<T: std::fmt::Debug>(&self, val: T) {
|
||||
println!("Going to print value");
|
||||
println!("{:?}", val);
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1 @@
|
||||
pub mod checks;
|
||||
pub mod conversions;
|
||||
|
||||
Reference in New Issue
Block a user