pub struct OpDef {
pub src: Vec<String>,
pub osrc: String,
pub csrc: String,
pub left: Option<i64>,
pub right: Option<i64>,
pub prefix: bool,
pub suffix: bool,
pub infix: bool,
pub ternary: bool,
pub paren: bool,
pub preval: Option<PrevalDef>,
pub use_data: Value,
}Expand description
One entry of the op option map: the definition of an operator.
src carries one source string for a prefix, suffix or infix
operator and two for a ternary (["?", ":"]); a paren operator uses
osrc and csrc instead.
Fields§
§src: Vec<String>§osrc: String§csrc: String§left: Option<i64>§right: Option<i64>§prefix: bool§suffix: bool§infix: bool§ternary: bool§paren: bool§preval: Option<PrevalDef>§use_data: ValueCustom operator data, handed back to an evaluator as op.use.
Implementations§
Source§impl OpDef
impl OpDef
Sourcepub fn infix(src: impl Into<String>, left: i64, right: i64) -> Self
pub fn infix(src: impl Into<String>, left: i64, right: i64) -> Self
An infix operator with the given source and binding powers.
Sourcepub fn prefix(src: impl Into<String>, right: i64) -> Self
pub fn prefix(src: impl Into<String>, right: i64) -> Self
A prefix operator with the given source and right binding power.
Sourcepub fn suffix(src: impl Into<String>, left: i64) -> Self
pub fn suffix(src: impl Into<String>, left: i64) -> Self
A suffix operator with the given source and left binding power.
Sourcepub fn ternary(first: impl Into<String>, second: impl Into<String>) -> Self
pub fn ternary(first: impl Into<String>, second: impl Into<String>) -> Self
A ternary operator with its two source strings.
Sourcepub fn paren(osrc: impl Into<String>, csrc: impl Into<String>) -> Self
pub fn paren(osrc: impl Into<String>, csrc: impl Into<String>) -> Self
A paren operator with its opening and closing source strings.
Sourcepub fn with_preval(self, preval: PrevalDef) -> Self
pub fn with_preval(self, preval: PrevalDef) -> Self
Give a paren operator a preval configuration.
Trait Implementations§
impl StructuralPartialEq for OpDef
Auto Trait Implementations§
impl Freeze for OpDef
impl RefUnwindSafe for OpDef
impl Send for OpDef
impl Sync for OpDef
impl Unpin for OpDef
impl UnsafeUnpin for OpDef
impl UnwindSafe for OpDef
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