mark core as nostd
* implement custom hashmap to back symtable * pass in print and read callbacks to keep stdlib pure * use core / alloc versions of Box, Rc, Vec, etc * replace pow func with libm Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
parent
0c2aad2cb6
commit
d6a0e68460
26 changed files with 493 additions and 288 deletions
|
|
@ -15,7 +15,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use std::fmt;
|
||||
use alloc::vec::Vec;
|
||||
use alloc::string::String;
|
||||
use core::fmt;
|
||||
use core::convert;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TraceItem {
|
||||
|
|
@ -32,7 +35,7 @@ pub fn start_trace(item: TraceItem) -> Traceback {
|
|||
|
||||
impl Traceback {
|
||||
pub fn new() -> Traceback {
|
||||
Traceback(vec![])
|
||||
Traceback(Vec::new())
|
||||
}
|
||||
|
||||
pub fn with_trace(mut self, item: TraceItem) -> Traceback {
|
||||
|
|
@ -56,13 +59,13 @@ impl fmt::Display for Traceback {
|
|||
}
|
||||
|
||||
|
||||
impl std::convert::From<Traceback> for String {
|
||||
impl convert::From<Traceback> for String {
|
||||
fn from(arg: Traceback) -> Self {
|
||||
format!("{}", arg)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<(&String, &str)> for TraceItem {
|
||||
impl convert::From<(&String, &str)> for TraceItem {
|
||||
fn from(value: (&String, &str)) -> Self {
|
||||
TraceItem {
|
||||
caller: value.0.clone(),
|
||||
|
|
@ -71,7 +74,7 @@ impl std::convert::From<(&String, &str)> for TraceItem {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<(&String, String)> for TraceItem {
|
||||
impl convert::From<(&String, String)> for TraceItem {
|
||||
fn from(value: (&String, String)) -> Self {
|
||||
TraceItem {
|
||||
caller: value.0.clone(),
|
||||
|
|
@ -80,7 +83,7 @@ impl std::convert::From<(&String, String)> for TraceItem {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<(&str, String)> for TraceItem {
|
||||
impl convert::From<(&str, String)> for TraceItem {
|
||||
fn from(value: (&str, String)) -> Self {
|
||||
TraceItem {
|
||||
caller: String::from(value.0),
|
||||
|
|
@ -89,7 +92,7 @@ impl std::convert::From<(&str, String)> for TraceItem {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<(&str, &str)> for TraceItem {
|
||||
impl convert::From<(&str, &str)> for TraceItem {
|
||||
fn from(value: (&str, &str)) -> Self {
|
||||
TraceItem {
|
||||
caller: String::from(value.0),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue