October commit

- custom parser support and infra
- type-tagging and traits (untested)
- match expressions
This commit is contained in:
2023-10-24 22:17:37 +01:00
parent c961506a3a
commit f77e4fd90a
73 changed files with 1904 additions and 558 deletions

View File

@@ -1,7 +1,7 @@
use std::fmt::Display;
use std::rc::Rc;
use std::sync::Arc;
use crate::foreign::ExternError;
use crate::foreign::{ExternError, XfnResult};
/// Some external event prevented the operation from succeeding
#[derive(Clone)]
@@ -13,15 +13,15 @@ pub struct RuntimeError {
impl RuntimeError {
/// Construct, upcast and wrap in a Result that never succeeds for easy
/// short-circuiting
pub fn fail<T>(
message: String,
operation: &'static str,
) -> Result<T, Rc<dyn ExternError>> {
pub fn fail<T>(message: String, operation: &'static str) -> XfnResult<T> {
Err(Self { message, operation }.into_extern())
}
/// Construct and upcast to [ExternError]
pub fn ext(message: String, operation: &'static str) -> Rc<dyn ExternError> {
pub fn ext(
message: String,
operation: &'static str,
) -> Arc<dyn ExternError> {
Self { message, operation }.into_extern()
}
}