use crate::{Result, prelude::*};
pub trait KotoFile: KotoRead + KotoWrite + KotoSend + KotoSync {
fn id(&self) -> KString;
fn path(&self) -> Result<KString> {
runtime_error!("unsupported for this file type")
}
fn seek(&self, _position: u64) -> Result<()> {
runtime_error!("unsupported for this file type")
}
fn is_terminal(&self) -> bool {
false
}
}
pub trait KotoRead {
fn read_line(&self) -> Result<Option<String>> {
runtime_error!("unsupported for this file type")
}
fn read_to_string(&self) -> Result<String> {
runtime_error!("unsupported for this file type")
}
}
pub trait KotoWrite {
fn write(&self, _bytes: &[u8]) -> Result<()> {
runtime_error!("unsupported for this file type")
}
fn write_line(&self, _text: &str) -> Result<()> {
runtime_error!("unsupported for this file type")
}
fn flush(&self) -> Result<()> {
runtime_error!("unsupported for this file type")
}
}