pub mod time;
use std::{fmt::{Debug, Display}, sync::Arc};
use arcstr::{literal, ArcStr};
use imbl::Vector;
use crate::{model::{Graph, Param}, runtime::{instruction::Instructions, proc::ProcEnv, Error, Type}};
#[cfg(feature = "system")]
pub mod filesys;
pub const FS_LIB: ArcStr = literal!("fs");
#[cfg(any(feature = "http", feature = "js"))]
pub mod http;
#[cfg(feature = "age_encrypt")]
pub mod age;
pub mod stof_std;
pub mod num;
pub mod string;
pub mod ver;
pub mod function;
pub mod list;
pub mod set;
pub mod map;
pub mod tup;
pub mod blob;
pub mod data;
pub mod obj;
pub mod prompt;
pub mod prof;
#[derive(Clone)]
pub struct LibFunc {
pub library: ArcStr,
pub name: String,
pub is_async: bool,
pub docs: String,
pub params: Vector<Param>,
pub unbounded_args: bool,
pub return_type: Option<Type>,
pub args_to_symbol_table: bool,
pub func: Arc<dyn Fn(bool, usize, &mut ProcEnv, &mut Graph)->Result<Instructions, Error> + Send + Sync + 'static>
}
impl Display for LibFunc {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut rtype = String::from("Void");
if let Some(ty) = &self.return_type { rtype = ty.type_of().to_string(); }
write!(f, "{}.{}({:?}) -> {};", self.library, self.name, self.params, &rtype)
}
}
impl Debug for LibFunc {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut rtype = String::from("Void");
if let Some(ty) = &self.return_type { rtype = ty.type_of().to_string(); }
write!(f, "{}.{}({:?}) -> {};", self.library, self.name, self.params, &rtype)
}
}