mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
fix(proc): use TryFromDsl locally
This commit is contained in:
parent
bad20f5037
commit
a9619ab9ce
3 changed files with 10 additions and 10 deletions
|
|
@ -5,3 +5,12 @@ pub type Usually<T> = Result<T, Box<dyn Error>>;
|
||||||
|
|
||||||
/// Standard optional result type.
|
/// Standard optional result type.
|
||||||
pub type Perhaps<T> = Result<Option<T>, Box<dyn Error>>;
|
pub type Perhaps<T> = Result<Option<T>, Box<dyn Error>>;
|
||||||
|
|
||||||
|
/// Implement the `From` trait.
|
||||||
|
#[macro_export] macro_rules! from {
|
||||||
|
($(<$($lt:lifetime),+>)?|$state:ident:$Source:ty|$Target:ty=$cb:expr) => {
|
||||||
|
impl $(<$($lt),+>)? From<$Source> for $Target {
|
||||||
|
fn from ($state:$Source) -> Self { $cb }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ impl ToTokens for CommandDef {
|
||||||
fn get <'source> (&self, iter: &mut ::tengri::dsl::TokenIter<'source>)
|
fn get <'source> (&self, iter: &mut ::tengri::dsl::TokenIter<'source>)
|
||||||
-> Option<#enumeration>
|
-> Option<#enumeration>
|
||||||
{
|
{
|
||||||
|
use ::tengri::dsl::TryFromDsl;
|
||||||
#enumeration::try_from_expr(self, iter)
|
#enumeration::try_from_expr(self, iter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,16 +33,6 @@ pub use ::ratatui; pub(crate) use ratatui::{
|
||||||
|
|
||||||
pub(crate) use std::sync::{Arc, RwLock, atomic::{AtomicBool, Ordering::*}};
|
pub(crate) use std::sync::{Arc, RwLock, atomic::{AtomicBool, Ordering::*}};
|
||||||
pub(crate) use std::io::{stdout, Stdout};
|
pub(crate) use std::io::{stdout, Stdout};
|
||||||
pub(crate) use std::path::PathBuf;
|
|
||||||
pub(crate) use std::ffi::OsString;
|
|
||||||
|
|
||||||
#[macro_export] macro_rules! from {
|
|
||||||
($(<$($lt:lifetime),+>)?|$state:ident:$Source:ty|$Target:ty=$cb:expr) => {
|
|
||||||
impl $(<$($lt),+>)? From<$Source> for $Target {
|
|
||||||
fn from ($state:$Source) -> Self { $cb }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)] #[test] fn test_tui_engine () -> Usually<()> {
|
#[cfg(test)] #[test] fn test_tui_engine () -> Usually<()> {
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue