Enum rslua_march1917::consts::Const
source · Variants§
Implementations§
source§impl Const
impl Const
sourcepub fn add(self, other: Const) -> Result<Option<Const>, CompileError>
pub fn add(self, other: Const) -> Result<Option<Const>, CompileError>
Examples found in repository?
src/compiler.rs (line 359)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
fn const_folding_bin_op(
&self,
op: BinOp,
l: Const,
r: Const,
) -> Result<Option<Const>, CompileError> {
let result = match op {
BinOp::Add => l.add(r)?,
BinOp::Minus => l.sub(r)?,
BinOp::Mul => l.mul(r)?,
BinOp::Div => l.div(r)?,
BinOp::IDiv => l.idiv(r)?,
BinOp::Mod => l.mod_(r)?,
BinOp::Pow => l.pow(r)?,
BinOp::BAnd => l.band(r)?,
BinOp::BOr => l.bor(r)?,
BinOp::BXor => l.bxor(r)?,
BinOp::Shl => l.shl(r)?,
BinOp::Shr => l.shr(r)?,
_ => None,
};
Ok(result)
}sourcepub fn sub(self, other: Const) -> Result<Option<Const>, CompileError>
pub fn sub(self, other: Const) -> Result<Option<Const>, CompileError>
Examples found in repository?
src/compiler.rs (line 360)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
fn const_folding_bin_op(
&self,
op: BinOp,
l: Const,
r: Const,
) -> Result<Option<Const>, CompileError> {
let result = match op {
BinOp::Add => l.add(r)?,
BinOp::Minus => l.sub(r)?,
BinOp::Mul => l.mul(r)?,
BinOp::Div => l.div(r)?,
BinOp::IDiv => l.idiv(r)?,
BinOp::Mod => l.mod_(r)?,
BinOp::Pow => l.pow(r)?,
BinOp::BAnd => l.band(r)?,
BinOp::BOr => l.bor(r)?,
BinOp::BXor => l.bxor(r)?,
BinOp::Shl => l.shl(r)?,
BinOp::Shr => l.shr(r)?,
_ => None,
};
Ok(result)
}sourcepub fn mul(self, other: Const) -> Result<Option<Const>, CompileError>
pub fn mul(self, other: Const) -> Result<Option<Const>, CompileError>
Examples found in repository?
src/compiler.rs (line 361)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
fn const_folding_bin_op(
&self,
op: BinOp,
l: Const,
r: Const,
) -> Result<Option<Const>, CompileError> {
let result = match op {
BinOp::Add => l.add(r)?,
BinOp::Minus => l.sub(r)?,
BinOp::Mul => l.mul(r)?,
BinOp::Div => l.div(r)?,
BinOp::IDiv => l.idiv(r)?,
BinOp::Mod => l.mod_(r)?,
BinOp::Pow => l.pow(r)?,
BinOp::BAnd => l.band(r)?,
BinOp::BOr => l.bor(r)?,
BinOp::BXor => l.bxor(r)?,
BinOp::Shl => l.shl(r)?,
BinOp::Shr => l.shr(r)?,
_ => None,
};
Ok(result)
}sourcepub fn div(self, other: Const) -> Result<Option<Const>, CompileError>
pub fn div(self, other: Const) -> Result<Option<Const>, CompileError>
Examples found in repository?
src/compiler.rs (line 362)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
fn const_folding_bin_op(
&self,
op: BinOp,
l: Const,
r: Const,
) -> Result<Option<Const>, CompileError> {
let result = match op {
BinOp::Add => l.add(r)?,
BinOp::Minus => l.sub(r)?,
BinOp::Mul => l.mul(r)?,
BinOp::Div => l.div(r)?,
BinOp::IDiv => l.idiv(r)?,
BinOp::Mod => l.mod_(r)?,
BinOp::Pow => l.pow(r)?,
BinOp::BAnd => l.band(r)?,
BinOp::BOr => l.bor(r)?,
BinOp::BXor => l.bxor(r)?,
BinOp::Shl => l.shl(r)?,
BinOp::Shr => l.shr(r)?,
_ => None,
};
Ok(result)
}sourcepub fn idiv(self, other: Const) -> Result<Option<Const>, CompileError>
pub fn idiv(self, other: Const) -> Result<Option<Const>, CompileError>
Examples found in repository?
src/compiler.rs (line 363)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
fn const_folding_bin_op(
&self,
op: BinOp,
l: Const,
r: Const,
) -> Result<Option<Const>, CompileError> {
let result = match op {
BinOp::Add => l.add(r)?,
BinOp::Minus => l.sub(r)?,
BinOp::Mul => l.mul(r)?,
BinOp::Div => l.div(r)?,
BinOp::IDiv => l.idiv(r)?,
BinOp::Mod => l.mod_(r)?,
BinOp::Pow => l.pow(r)?,
BinOp::BAnd => l.band(r)?,
BinOp::BOr => l.bor(r)?,
BinOp::BXor => l.bxor(r)?,
BinOp::Shl => l.shl(r)?,
BinOp::Shr => l.shr(r)?,
_ => None,
};
Ok(result)
}sourcepub fn mod_(self, other: Const) -> Result<Option<Const>, CompileError>
pub fn mod_(self, other: Const) -> Result<Option<Const>, CompileError>
Examples found in repository?
src/compiler.rs (line 364)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
fn const_folding_bin_op(
&self,
op: BinOp,
l: Const,
r: Const,
) -> Result<Option<Const>, CompileError> {
let result = match op {
BinOp::Add => l.add(r)?,
BinOp::Minus => l.sub(r)?,
BinOp::Mul => l.mul(r)?,
BinOp::Div => l.div(r)?,
BinOp::IDiv => l.idiv(r)?,
BinOp::Mod => l.mod_(r)?,
BinOp::Pow => l.pow(r)?,
BinOp::BAnd => l.band(r)?,
BinOp::BOr => l.bor(r)?,
BinOp::BXor => l.bxor(r)?,
BinOp::Shl => l.shl(r)?,
BinOp::Shr => l.shr(r)?,
_ => None,
};
Ok(result)
}sourcepub fn pow(self, other: Const) -> Result<Option<Const>, CompileError>
pub fn pow(self, other: Const) -> Result<Option<Const>, CompileError>
Examples found in repository?
src/compiler.rs (line 365)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
fn const_folding_bin_op(
&self,
op: BinOp,
l: Const,
r: Const,
) -> Result<Option<Const>, CompileError> {
let result = match op {
BinOp::Add => l.add(r)?,
BinOp::Minus => l.sub(r)?,
BinOp::Mul => l.mul(r)?,
BinOp::Div => l.div(r)?,
BinOp::IDiv => l.idiv(r)?,
BinOp::Mod => l.mod_(r)?,
BinOp::Pow => l.pow(r)?,
BinOp::BAnd => l.band(r)?,
BinOp::BOr => l.bor(r)?,
BinOp::BXor => l.bxor(r)?,
BinOp::Shl => l.shl(r)?,
BinOp::Shr => l.shr(r)?,
_ => None,
};
Ok(result)
}sourcepub fn band(self, other: Const) -> Result<Option<Const>, CompileError>
pub fn band(self, other: Const) -> Result<Option<Const>, CompileError>
Examples found in repository?
src/compiler.rs (line 366)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
fn const_folding_bin_op(
&self,
op: BinOp,
l: Const,
r: Const,
) -> Result<Option<Const>, CompileError> {
let result = match op {
BinOp::Add => l.add(r)?,
BinOp::Minus => l.sub(r)?,
BinOp::Mul => l.mul(r)?,
BinOp::Div => l.div(r)?,
BinOp::IDiv => l.idiv(r)?,
BinOp::Mod => l.mod_(r)?,
BinOp::Pow => l.pow(r)?,
BinOp::BAnd => l.band(r)?,
BinOp::BOr => l.bor(r)?,
BinOp::BXor => l.bxor(r)?,
BinOp::Shl => l.shl(r)?,
BinOp::Shr => l.shr(r)?,
_ => None,
};
Ok(result)
}sourcepub fn bor(self, other: Const) -> Result<Option<Const>, CompileError>
pub fn bor(self, other: Const) -> Result<Option<Const>, CompileError>
Examples found in repository?
src/compiler.rs (line 367)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
fn const_folding_bin_op(
&self,
op: BinOp,
l: Const,
r: Const,
) -> Result<Option<Const>, CompileError> {
let result = match op {
BinOp::Add => l.add(r)?,
BinOp::Minus => l.sub(r)?,
BinOp::Mul => l.mul(r)?,
BinOp::Div => l.div(r)?,
BinOp::IDiv => l.idiv(r)?,
BinOp::Mod => l.mod_(r)?,
BinOp::Pow => l.pow(r)?,
BinOp::BAnd => l.band(r)?,
BinOp::BOr => l.bor(r)?,
BinOp::BXor => l.bxor(r)?,
BinOp::Shl => l.shl(r)?,
BinOp::Shr => l.shr(r)?,
_ => None,
};
Ok(result)
}sourcepub fn bxor(self, other: Const) -> Result<Option<Const>, CompileError>
pub fn bxor(self, other: Const) -> Result<Option<Const>, CompileError>
Examples found in repository?
src/compiler.rs (line 368)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
fn const_folding_bin_op(
&self,
op: BinOp,
l: Const,
r: Const,
) -> Result<Option<Const>, CompileError> {
let result = match op {
BinOp::Add => l.add(r)?,
BinOp::Minus => l.sub(r)?,
BinOp::Mul => l.mul(r)?,
BinOp::Div => l.div(r)?,
BinOp::IDiv => l.idiv(r)?,
BinOp::Mod => l.mod_(r)?,
BinOp::Pow => l.pow(r)?,
BinOp::BAnd => l.band(r)?,
BinOp::BOr => l.bor(r)?,
BinOp::BXor => l.bxor(r)?,
BinOp::Shl => l.shl(r)?,
BinOp::Shr => l.shr(r)?,
_ => None,
};
Ok(result)
}sourcepub fn shl(self, other: Const) -> Result<Option<Const>, CompileError>
pub fn shl(self, other: Const) -> Result<Option<Const>, CompileError>
Examples found in repository?
src/compiler.rs (line 369)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
fn const_folding_bin_op(
&self,
op: BinOp,
l: Const,
r: Const,
) -> Result<Option<Const>, CompileError> {
let result = match op {
BinOp::Add => l.add(r)?,
BinOp::Minus => l.sub(r)?,
BinOp::Mul => l.mul(r)?,
BinOp::Div => l.div(r)?,
BinOp::IDiv => l.idiv(r)?,
BinOp::Mod => l.mod_(r)?,
BinOp::Pow => l.pow(r)?,
BinOp::BAnd => l.band(r)?,
BinOp::BOr => l.bor(r)?,
BinOp::BXor => l.bxor(r)?,
BinOp::Shl => l.shl(r)?,
BinOp::Shr => l.shr(r)?,
_ => None,
};
Ok(result)
}sourcepub fn shr(self, other: Const) -> Result<Option<Const>, CompileError>
pub fn shr(self, other: Const) -> Result<Option<Const>, CompileError>
Examples found in repository?
src/compiler.rs (line 370)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
fn const_folding_bin_op(
&self,
op: BinOp,
l: Const,
r: Const,
) -> Result<Option<Const>, CompileError> {
let result = match op {
BinOp::Add => l.add(r)?,
BinOp::Minus => l.sub(r)?,
BinOp::Mul => l.mul(r)?,
BinOp::Div => l.div(r)?,
BinOp::IDiv => l.idiv(r)?,
BinOp::Mod => l.mod_(r)?,
BinOp::Pow => l.pow(r)?,
BinOp::BAnd => l.band(r)?,
BinOp::BOr => l.bor(r)?,
BinOp::BXor => l.bxor(r)?,
BinOp::Shl => l.shl(r)?,
BinOp::Shr => l.shr(r)?,
_ => None,
};
Ok(result)
}