use crate::iex;
pub struct HasIexMethod;
impl HasIexMethod {
#[iex]
pub fn iex_method() -> Result<(), ()> {
Ok(())
}
}
pub trait SayHello {
#[iex]
fn provided_method(self) -> Result<String, ()>
where
Self: Sized,
{
Ok("Default implementation says Hello!".to_string())
}
#[iex]
fn required_method(&self) -> Result<(), ()>;
}
impl SayHello for String {
#[iex]
fn provided_method(self) -> Result<String, ()> {
Ok(self)
}
#[iex]
fn required_method(&self) -> Result<(), ()> {
Ok(())
}
}
#[iex]
pub fn add(a: i32, b: i32) -> Result<i32, i32> {
a.checked_add(b).ok_or(a.wrapping_add(b))
}