pub struct EffectExpression { /* private fields */ }Expand description
A parsed representation of a tachyonfx effect expression.
EffectExpression provides a way to parse and represent effect descriptions in string
form. This allows effects to be defined using a domain-specific language (DSL) syntax
and later converted into actual effect instances.
§Examples
use tachyonfx::dsl::EffectExpression;
// Parse a simple fade effect
let expr = EffectExpression::parse("fx::fade_to(Color::from_u32(0), (500, Linear))").unwrap();
// Parse a more complex effect chain
let expr = EffectExpression::parse(r#"
fx::sequence(&[
fx::fade_from(Color::Black, Color::from_u32(0), (1000, QuadOut)),
fx::dissolve((500, BounceOut))
])
"#);§See Also
Shader::to_dslfor converting a shader to a DSL expressionDslErrorfor possible error types
Implementations§
Source§impl EffectExpression
impl EffectExpression
Sourcepub fn parse(input: &str) -> Result<Self, DslError>
pub fn parse(input: &str) -> Result<Self, DslError>
Parses a string into an EffectExpression.
This method takes a string containing a tachyonfx effect description and attempts
to parse it into a structured EffectExpression. The input string should follow
the tachyonfx DSL syntax.
§Arguments
input- A string slice containing the effect expression to parse
§Returns
Returns a Result containing either:
Ok(EffectExpression)if parsing was successfulErr(DslError)if the input could not be parsed
§Errors
Returns DslError if tokenization or AST parsing fails.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for EffectExpression
impl !Send for EffectExpression
impl !Sync for EffectExpression
impl !UnwindSafe for EffectExpression
impl Freeze for EffectExpression
impl Unpin for EffectExpression
impl UnsafeUnpin for EffectExpression
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> ThreadSafetyMarker for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more