pub enum Op2Enum {
Show 40 variants
Concat(Concat),
Eq(Eq),
At(At),
PrefixOf(PrefixOf),
SuffixOf(SuffixOf),
Contains(Contains),
Split(Split),
Join(Join),
Count(Count),
Add(Add),
Sub(Sub),
Head(Head),
Tail(Tail),
TimeFloor(TimeFloor),
TimeAdd(TimeAdd),
Floor(Floor),
Round(Round),
Ceil(Ceil),
FAdd(FAdd),
FSub(FSub),
FFloor(FFloor),
FRound(FRound),
FCeil(FCeil),
FCount(FCount),
FShl10(FShl10),
TimeMul(TimeMul),
StrAt(StrAt),
BvAdd(BvAdd),
BvSub(BvSub),
BvMul(BvMul),
BvUDiv(BvUDiv),
BvURem(BvURem),
BvSDiv(BvSDiv),
BvSRem(BvSRem),
BvOr(BvOr),
BvAnd(BvAnd),
BvXor(BvXor),
BvShl(BvShl),
BvAShr(BvAShr),
BvLShr(BvLShr),
}
Expand description
An enum representing binary operations used in the expression manipulation framework.
This enumeration includes a diverse set of operations applicable to strings, numbers, lists, and time-related data.
Typical operations include string manipulations such as Concat
, PrefixOf
, and Contains
, which allow for constructing and checking properties of strings.
There are also numerical operations like Add
, Sub
, alongside floating-point specific operations like FAdd
, FSub
, and rounding techniques such as Floor
, Round
, and Ceil
.
Moreover, the enum encapsulates list operations such as Head
, Tail
, and Filter
, indicating capabilities to manipulate and traverse lists.
Time-based operations like TimeFloor
, TimeAdd
, and TimeMul
are included, reflecting tasks related to temporal data.
Split
and Join
manage compound string or list structures, and StrAt
and At
facilitate index-based access in strings or lists.
The enumeration is designed to accommodate various contexts and operations necessary for a comprehensive synthesis framework, supporting diverse data types and manipulation techniques.
Variants§
Concat(Concat)
Eq(Eq)
At(At)
PrefixOf(PrefixOf)
SuffixOf(SuffixOf)
Contains(Contains)
Split(Split)
Join(Join)
Count(Count)
Add(Add)
Sub(Sub)
Head(Head)
Tail(Tail)
TimeFloor(TimeFloor)
TimeAdd(TimeAdd)
Floor(Floor)
Round(Round)
Ceil(Ceil)
FAdd(FAdd)
FSub(FSub)
FFloor(FFloor)
FRound(FRound)
FCeil(FCeil)
FCount(FCount)
FShl10(FShl10)
TimeMul(TimeMul)
StrAt(StrAt)
BvAdd(BvAdd)
BvSub(BvSub)
BvMul(BvMul)
BvUDiv(BvUDiv)
BvURem(BvURem)
BvSDiv(BvSDiv)
BvSRem(BvSRem)
BvOr(BvOr)
BvAnd(BvAnd)
BvXor(BvXor)
BvShl(BvShl)
BvAShr(BvAShr)
BvLShr(BvLShr)
Implementations§
Source§impl Op2Enum
impl Op2Enum
Sourcepub fn eval(&self, a1: Value, a2: Value) -> Value
pub fn eval(&self, a1: Value, a2: Value) -> Value
Evaluates a binary operation encapsulated by the Op2Enum
.
It takes two arguments, both of type Value
, and returns the result of attempting the operation.
The method utilizes the try_eval
function internally, discarding the primary component of its result and only retaining the secondary element, which represents the successfully evaluated output.
This signifies that while the try_eval
function may return additional diagnostic information or status, this method focuses solely on obtaining the computed value from the operation.
Source§impl Op2Enum
impl Op2Enum
Sourcepub fn from_name(name: &str, config: &Config) -> Self
pub fn from_name(name: &str, config: &Config) -> Self
Converts a string name into an Op2Enum
variant by matching the provided name with known operation names and configurations.
The function utilizes a macro to iterate through all defined binary operations (Op2
) and checks if the operation’s name matches the input string.
If a match is found, it retrieves the operation with the given configuration and converts it into the Op2Enum
type.
For specific operators like "+"
and "-"
, the function directly constructs their corresponding Add
or Sub
variants, respectively.
If no matching operation is found, it raises a panic with an error message indicating the unknown operator name.
Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
Returns the name of the operation represented by the given instance of the enumeration.
This implementation utilizes a macro to iterate over possible operation variants defined in the enumeration, invoking the name
method on each.
The name
method of a specific operation is called, and its result is returned if the instance matches one of the variants.
If no match is found, the function will trigger a panic, indicating that the instance does not correspond to a recognized operation variant.
This design aims to streamline name retrieval across multiple operation types within the Op2Enum
.
Trait Implementations§
Source§impl Display for Op2Enum
impl Display for Op2Enum
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Provides a formatting implementation for the Op2Enum
type, utilizing the Rust standard library’s fmt
trait.
This method employs a macro to streamline the process of matching against all possible Op2Enum
variants, applying the formatting operation uniformly.
Within the macro _do
, each variant is checked using pattern matching, and upon a match, it writes the variant’s name to the provided formatter.
The macro ultimately integrates with a custom crate-level macro crate::for_all_op2!()
to encompass all operations within Op2Enum
, ensuring the method comprehensively formats each operation, returning a Result
to indicate success or failure of the formatting operation.
Source§impl Enumerator2 for Op2Enum
impl Enumerator2 for Op2Enum
impl Eq for Op2Enum
impl StructuralPartialEq for Op2Enum
Auto Trait Implementations§
impl Freeze for Op2Enum
impl RefUnwindSafe for Op2Enum
impl Send for Op2Enum
impl Sync for Op2Enum
impl Unpin for Op2Enum
impl UnwindSafe for Op2Enum
Blanket Implementations§
Source§impl<T> AllocForAny<T> for T
impl<T> AllocForAny<T> for T
Source§fn galloc(self) -> &'static T
fn galloc(self) -> &'static T
Provides a method to allocate an instance of T
on the heap with a static lifetime.
This implementation of galloc
takes ownership of the T
instance and uses the alloc
function to place it in a location with a static lifetime, presumably managing it in a way that ensures its persistence for the duration of the program.
This can be particularly useful for scenarios where a static lifetime is required, such as when interfacing with systems or patterns that necessitate global state or long-lived data.
Source§fn galloc_mut(self) -> &'static T
fn galloc_mut(self) -> &'static T
Provides a method that moves the instance and returns a reference to it allocated with a static lifetime.
This method utilizes alloc_mut
to perform the allocation, likely involving allocating the resource in a manner that ensures it lives for the entire duration of the application.
These semantics allow the user to safely assume that the reference will not expire during the program’s execution, making it suitable for long-lived data structures or operations that require such guarantees.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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>
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>
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 more