From fc2c9b77ecc5c64a3fea7f02754a30c4925c2eb5 Mon Sep 17 00:00:00 2001 From: Yash Karandikar Date: Mon, 20 Sep 2021 08:49:48 -0500 Subject: [PATCH] Refactor to remove arrayvec --- Cargo.lock | 7 ------- Cargo.toml | 4 ---- src/interrupts.rs | 4 ++-- src/shell.rs | 6 +++--- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec9c1a3..d2fc72b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6,7 +6,6 @@ version = 3 name = "KarxOS" version = "0.1.0" dependencies = [ - "arrayvec", "bootloader", "lazy_static", "linked_list_allocator", @@ -17,12 +16,6 @@ dependencies = [ "x86_64", ] -[[package]] -name = "arrayvec" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4dc07131ffa69b8072d35f5007352af944213cde02545e2103680baed38fcd" - [[package]] name = "bit_field" version = "0.10.1" diff --git a/Cargo.toml b/Cargo.toml index 545d336..4cb0734 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,10 +17,6 @@ linked_list_allocator = "0.9.0" version = "1.0" features = ["spin_no_std"] -[dependencies.arrayvec] -version = "0.7.1" -default-features = false - [dependencies.bootloader] version = "0.9.19" features = ["map_physical_memory"] diff --git a/src/interrupts.rs b/src/interrupts.rs index 58e62e9..61f4de4 100644 --- a/src/interrupts.rs +++ b/src/interrupts.rs @@ -72,11 +72,11 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac } else if character == '\u{9}' { print!(" "); } else if character == '\n' { - use arrayvec::ArrayString; + use alloc::string::String; let writer = crate::vga_buffer::WRITER.lock(); // Gather all chars in the current row into one ArrayString - let mut builder = ArrayString::<80>::new(); + let mut builder = String::new(); for character in &writer.buffer.chars[crate::vga_buffer::BUFFER_HEIGHT - 1] { builder.push(character.read().ascii_character as char); diff --git a/src/shell.rs b/src/shell.rs index cf03c22..5ac3e14 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -2,14 +2,14 @@ use crate::print; use crate::println; use crate::vga_buffer::ScreenChar; use crate::vga_buffer::{change_color, Color}; -use arrayvec::{ArrayString, ArrayVec}; +use alloc::{vec::Vec, string::String}; pub fn evaluate(command: &str) { if let Some(stripped) = command.strip_prefix(">>> ") { let res = stripped.trim(); if res != "" { println!(); - let parts: ArrayVec<&str, 80> = res.split(" ").collect(); + let parts: Vec<&str> = res.split(" ").collect(); let selected = match parts[0] { "help" => help, "info" => info, @@ -52,7 +52,7 @@ fn info(_arguments: &[&str]) { fn echo(arguments: &[&str]) { // Join the arguments back into an ArrayString - let mut new: ArrayString<80> = ArrayString::new(); + let mut new = String::new(); for arg in &arguments[1..] { new.push_str(arg); new.push(' ');