Add stubs for MathNumber.

This commit is contained in:
Tom Alexander
2020-06-13 22:23:40 -04:00
parent d8b8c223f0
commit 0a2e1b007c
2 changed files with 84 additions and 0 deletions

View File

@@ -5,6 +5,10 @@ use crate::renderer::errors::WalkError;
use crate::renderer::DustRenderer;
use std::any::Any;
use std::ops::Add;
use std::ops::Div;
use std::ops::Mul;
use std::ops::Rem;
use std::ops::Sub;
use std::rc::Rc;
use std::{cmp::Ordering, fmt::Debug};
@@ -104,6 +108,38 @@ impl<'a> Add<&'a dyn ContextElement> for &'a dyn ContextElement {
}
}
impl<'a> Sub<&'a dyn ContextElement> for &'a dyn ContextElement {
type Output = Option<IceResult<'a>>;
fn sub(self, other: &'a dyn ContextElement) -> Self::Output {
self.math_subtract(other)
}
}
impl<'a> Mul<&'a dyn ContextElement> for &'a dyn ContextElement {
type Output = Option<IceResult<'a>>;
fn mul(self, other: &'a dyn ContextElement) -> Self::Output {
self.math_multiply(other)
}
}
impl<'a> Div<&'a dyn ContextElement> for &'a dyn ContextElement {
type Output = Option<IceResult<'a>>;
fn div(self, other: &'a dyn ContextElement) -> Self::Output {
self.math_divide(other)
}
}
impl<'a> Rem<&'a dyn ContextElement> for &'a dyn ContextElement {
type Output = Option<IceResult<'a>>;
fn rem(self, other: &'a dyn ContextElement) -> Self::Output {
self.math_modulus(other)
}
}
pub trait FromContextElement {
fn from_context_element(&self) -> &dyn IntoContextElement;
}