Struct erg_common::io::Input
source · pub struct Input { /* private fields */ }
Expand description
Since input is not always only from files
Unify operations with Input
Implementations§
source§impl Input
impl Input
pub const fn new(kind: InputKind, id: u64) -> Self
pub fn file(path: PathBuf) -> Self
pub fn pipe(src: String) -> Self
pub fn str(src: String) -> Self
pub fn repl() -> Self
pub fn dummy() -> Self
pub fn dummy_repl(stdin: DummyStdin) -> Self
pub const fn is_repl(&self) -> bool
pub const fn id(&self) -> u64
pub fn dir(&self) -> PathBuf
pub fn project_root(&self) -> Option<PathBuf>
pub fn enclosed_name(&self) -> &str
pub fn lineno(&self) -> usize
pub fn block_begin(&self) -> usize
pub fn set_block_begin(&self)
pub fn insert_whitespace(&self, whitespace: &str)
pub fn set_indent(&self, indent: usize)
pub fn file_stem(&self) -> String
pub fn full_path(&self) -> PathBuf
pub fn filename(&self) -> String
pub fn module_name(&self) -> String
pub fn read(&mut self) -> String
pub fn source_exists(&self) -> bool
pub fn try_read(&mut self) -> Result<String>
pub fn read_non_dummy(&self) -> String
pub fn reread_lines(&self, ln_begin: usize, ln_end: usize) -> Vec<String>
pub fn reread(&self) -> String
pub fn sys_path(&self) -> Result<Vec<PathBuf>, Error>
pub fn resolve_py(&self, path: &Path) -> Result<PathBuf, Error>
pub fn resolve_path(&self, path: &Path, cfg: &ErgConfig) -> Option<PathBuf>
sourcepub fn resolve_real_path(&self, path: &Path, cfg: &ErgConfig) -> Option<PathBuf>
pub fn resolve_real_path(&self, path: &Path, cfg: &ErgConfig) -> Option<PathBuf>
resolution order:
./{path/to}.er
./{path/to}/__init__.er
std/{path/to}.er
std/{path/to}/__init__.er
pkgs/{path/to}/src/lib.er
sourcepub fn resolve_decl_path(&self, path: &Path, cfg: &ErgConfig) -> Option<PathBuf>
pub fn resolve_decl_path(&self, path: &Path, cfg: &ErgConfig) -> Option<PathBuf>
resolution order:
{path/to}.d.er
{path/to}/__init__.d.er
{path}/__pycache__/{to}.d.er
{path/to}/__pycache__/__init__.d.er
{path.d/to.d}/__init__.d.er
{path.d/to.d}/__pycache__/__init__.d.er
(and repeat for the project root)std/{path/to}.d.er
std/{path/to}/__init__.d.er
pkgs/{path/to}/src/lib.d.er
site-packages/{path}/__pycache__/{to}.d.er
site-packages/{path/to}/__pycache__/__init__.d.er
pub fn try_push_path(path: PathBuf, add: &Path) -> Result<PathBuf, String>
pub fn decl_file_is(&self, decl_path: &Path) -> bool
pub fn mode(&self) -> &'static str
Trait Implementations§
source§impl PartialEq for Input
impl PartialEq for Input
impl Eq for Input
impl StructuralPartialEq for Input
Auto Trait Implementations§
impl Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more